if((i%5==0)||(i%3==0))
{
sum=sum+1;
}
should be
if((i%5==0)||(i%3==0))
{
sum=sum+i;
}
solved Find the sum of all the multiples of 3 or 5 below 1000 [duplicate]
if((i%5==0)||(i%3==0))
{
sum=sum+1;
}
should be
if((i%5==0)||(i%3==0))
{
sum=sum+i;
}
solved Find the sum of all the multiples of 3 or 5 below 1000 [duplicate]