Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Simple Incrementing Problem

Name: Anonymous 2014-03-04 22:59

I don't know exactly what to do in this problem. It seems maddeningly simple, but I'm at a loss.

I want to find all of the multiples of 3 and 5 that are less than 1000, then find their sum.

I've got this:

while (x < 999 && y < 1000):
{
    x += 3;
    y += 5;
}

Where/how can I calculate the sum?

Name: Anonymous 2014-03-05 11:39

YA DONT NEED ITERATION

int c = 15; // 3*5
int l = 1000;
int n = l/c;
printf("%d\n", (c*n*(1+n))/2);

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List