Advertisement
Guest User

Untitled

a guest
Oct 8th, 2018
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class P3_ExchangeIntegers {
  4.  
  5. public static void main(String[] args) {
  6.  
  7. Scanner scan = new Scanner(System.in);
  8.  
  9. int a = Integer.parseInt(scan.nextLine());
  10. int b = Integer.parseInt(scan.nextLine());
  11.  
  12. int tempB = b;
  13.  
  14. b = a;
  15.  
  16.  
  17. System.out.printf("Before:%n a = %d%n b = %d%n", a , tempB);
  18. System.out.printf("After:%n a = %d%n b = %d%n", tempB, b);
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement