Advertisement
Guest User

Untitled

a guest
Jun 21st, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Mlody {
  4.  
  5.     public static void main(String[] args) {
  6.  
  7.        
  8.         int x = 0;
  9.        
  10.         Scanner sc = new Scanner(System.in);
  11.         System.out.println("Podaj pierwszą wartość X: \n");
  12.         x = sc.nextInt();
  13.         int y = x;
  14.         while(true) {
  15.            
  16.            
  17.             System.out.println("Podaj liczbe o którą należy podnieść X: ");
  18.             x += sc.nextInt();
  19.            
  20.             if(y==x) {
  21.                 System.out.println("X się nie zmienił");
  22.                
  23.                
  24.             }else {
  25.                 System.out.println("Obecnie x wynosi:" + x);
  26.                 y=x;
  27.            
  28.             }
  29.            
  30.         }
  31.        
  32.     }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement