Advertisement
mmayoub

Ex03, 05.06.2021

Jun 5th, 2021
956
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.27 KB | None | 0 0
  1. public class Ex03 {
  2.  
  3.     public static void main(String[] args) {
  4.         int x = 0;
  5.         int y = 0;
  6.         int i;
  7.  
  8.         for (i = 1; i <= 5; i++) {
  9.             x = x + 2; // x += 2
  10.             y = y + x; // y += x
  11.  
  12.         }
  13.  
  14.         System.out.println("x = " + x);
  15.         System.out.println("y = " + y);
  16.  
  17.     }
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement