Euler #1

kinuthiA muchanE muchanek at
Tue Jul 22 10:25:25 BST 2008


If you are getting it correct for 10, then I do not understand why you
cannot get for 1000. You just need to swap the two numbers. Can we see
the code ? ...and your answer is a bit on the higher side.

You could initialize a variable named, say, "total" to zero. Then create
a "while" or a "for" loop, whose limit is LESS than 1000. Then check for
numbers which are a multiples of 3 OR 5, if you find one you add it to
total, when the loop terminates the final value of total is the answer
you are looking.
Does this help?
On Tue, 2008-07-22 at 10:21 +0300, Eric Kivuti wrote:
> This email is from a ubuntu-ke subscriber to other subscribers inluding you:)
> I've tried Q1, did a C++ program that calculated the correct value of 23
> plus shows which numbers. I did for below 10 and it worked.. I did for below
> 1000 and the answer I got was 266333.. the site says it's wrong.. What math
> am I missin?
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: 

More information about the Ubuntu-ke mailing list