Home > Back-end >  Java related questions really don't know what wrong please everybody
Java related questions really don't know what wrong please everybody

Time:12-26

To use the do - whhile circulation structure implementation: 1 ~ 50 is calculated by the sum of the value of multiple of 7 and output
Tip: use the % operator judgment multiple of 7


Int a=1;
int sum=0;
Do {
Sum=sum + 0;
System. The out. Println (sum);
+;

7==0} while (a % & amp; & a<=50);
}

Please you really don't know where have problem? Thank you for your

CodePudding user response:

A % 7==0 & amp; & a<=50, this is only cycle is 7 digits, must only output 1 0 ended,
To try this
 
Int a=1;
int sum=0;
Do {
If (a % 7==0) {
Sum=sum + 0;
System. The out. Println (sum);
}
+;

} while (a<=50);
}
  • Related