sum of multiples 09-22-2014, 08:24 AM
#1
Find the sum of the multiples of 5 or 7 under 851
i know it's easy but i didn't sleep well yesterday and i'm eally not focued can't figure out what im doing wrong here here's my code help appreciated pls !!
i know it's easy but i didn't sleep well yesterday and i'm eally not focued can't figure out what im doing wrong here here's my code help appreciated pls !!
Spoiler:
Code:
public static void main(String[] args) {
int sum1 = 0, sum2 = 0;
int i = 0;
int i1 = 0;
do {
i = i + 5;
} while (i < 851);
System.out.println(i);
do {
i1 = i1 + 7;
} while (i1 < 851);
System.out.println(i1);
i += i1;
System.out.println("solution = " + i);
}
}




![[+]](https://sinister.li/images/modern/collapse_collapsed.png)