CodePudding user response:
Public static void main (String [] args) {
int sum=0;
for (int i=1; i <=1000; I++) {
If (I % 3==0)
The sum +=I;
}
System. The out. Println (sum);
}
CodePudding user response:
int sum=0;for(i=0; i<=1000; I++) {
If (I % 3==0) {sum +=I; }
}
System. The out. Println (sum);
CodePudding user response:
3 increasing multiple of 3, without doing modulus operationint sum=0;
For (int I=3; i<=1000; I +=3) {
The sum +=I;
}
System. The out. Println (sum);