/*If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9.
The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000. */
When I put 10 the answer is 23,when I try for 1000,output:266333,which is a wrong answer according to the eulerproject.netCode:#include<stdio.h> int main() { int i=1,m3=0,n; for(;i<10;i++) { if(((n=i*3)<10)) m3+=n; if((n=i*5)<10) m3+=n; } printf("res=%d\n",m3); return 0; }
What is wrong in the program?