Output:
Click Here For Java Online Compiler
Solution:
*** Swap Two Numbers Using Third Variable *** *** Before swapping *** a = 15 b = 27 *** After swapping *** a = 27 b = 15
Click Here For Java Online Compiler
Solution:
public class SwapTwoNumbers1 { public static void main(String[] args) { int a, b, temp; a = 15; b = 27; System.out.println("*** Swap Two Numbers Using Third Variable ***" + "\n"); System.out.println("*** Before swapping ***"); System.out.println("a = " + a); System.out.println("b = " + b); temp = a; a = b; b = temp; System.out.println("*** After swapping ***"); System.out.println("a = " + a); System.out.println("b = " + b); } }
comment 0 comments:
more_vertsentiment_satisfied Emoticon