Created
August 20, 2017 20:51
-
-
Save thmain/dcc837622616fc16f99317e23b3758be to your computer and use it in GitHub Desktop.
This file contains 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 characters
public class SwapNumbers { | |
public static void swap(int a, int b){ | |
System.out.println("first number: " + a + " second number: " + b); | |
a = a + b; | |
b = a - b; | |
a = a - b; | |
System.out.println("After Swappng: first number: " + a + " second number: " + b); | |
} | |
public static void main(String[] args) { | |
int a = 3; | |
int b = 5; | |
swap(a,b); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment