Advertisement
Guest User

Untitled

a guest
Apr 20th, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3.  
  4. public class Unequal {
  5.  
  6. static Scanner sc = new Scanner(System.in);
  7.  
  8.  
  9. public static void main(String[] args) {
  10.  
  11. int x;
  12. int y;
  13. int z;
  14. int a;
  15.  
  16.  
  17. System.out.println("Please input a number: ");
  18.  
  19. x = sc.nextInt();
  20.  
  21. System.out.println("Please input another number: ");
  22.  
  23. y = sc.nextInt();
  24.  
  25. if (x != (y)) {
  26. System.out.println(x +" is a different number than " + y); }
  27.  
  28. System.out.println("Would you like me to add those numbers together?");
  29.  
  30. a = (x + y);
  31.  
  32. z = sc.nextInt();
  33.  
  34. if (z == 0) {
  35. System.out.println(x + "+" + y + " = " + a );
  36. }
  37. else
  38. System.out.println("Never mind...");
  39.  
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement