Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class DoWhile {
- public static void main (String[] args ){
- System.out.print("x = ");
- int i=0,x=0;
- do {
- if (((++i % 2) == 0) && (i<20)){
- System.out.print(i + " + ");
- x += i;
- }
- else if (i==20) {
- System.out.print(i);
- x += i;}
- }
- while(i<20);
- System.out.println("\nx = " + x);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement