Created
January 21, 2015 14:05
-
-
Save scratchyourbrain/5e3edfbd40a45edf5b27 to your computer and use it in GitHub Desktop.
Revisions
-
scratchyourbrain created this gist
Jan 21, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ import java.io.*; import java.util.*; class swap { public static void main(String args[]) { Scanner s = new Scanner(System.in); System.out.print("Enter two numbers : "); int m = s.nextInt(); int n = s.nextInt(); int temp; System.out.println("BEFORE SWAP"); System.out.println("m = " + m + " n = " + n); temp = n; n = m; m = temp; System.out.println("AFTER SWAP"); System.out.println("m = " + m + " n = " + n); } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ import java.io.*; import java.util.*; class swap { public static void main(String args[]) { Scanner s = new Scanner(System.in); System.out.print("Enter two numbers : "); int m = s.nextInt(); int n = s.nextInt(); int temp; System.out.println("BEFORE SWAP"); System.out.println("m = " + m + " n = " + n); m = m + n; n = m - n; m = m - n; System.out.println("AFTER SWAP"); System.out.println("m = " + m + " n = " + n); } }