TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Zu Sung Park
NA
5
2.7k
Stuck on a simple problem: Find the sum of all the multiples of 3 or 5 below 1000.
Dec 7 2011 7:16 AM
Hi need some help with the summing of this simple problem. Seems that it doesn't save on the arrays.
Here is the code:
using System;
namespace test
{
class Program
{
static void Main()
{
Program p = new Program();
p.sum(1000);
Console.ReadLine();
}
public void sum (int tal)
{
for (int i = 1; i < tal; i++)
{
int[] array= new int[1000];
if (i % 3 == 0 || i % 5 == 0)
{
array[i] += i;
Console.WriteLine(array[i]);
}
}
}
}
}
Can someone give me the guidance to complete this one!?
Best regards,
Reply
Answers (
5
)
Parsing a String
How to dynamic increment with character for example E001