We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents e3916b1 + 27d40e7 commit e55deb9Copy full SHA for e55deb9
1 file changed
swap.java
@@ -0,0 +1,17 @@
1
+import java.util.Scanner;
2
+class SwapNumbers
3
+{
4
+public static void main(String args[])
5
6
+int z, y, temp;
7
+System.out.println("Enter z and y");
8
+Scanner sct = new Scanner(System.in); //User inputs two numbers
9
+z = sct.nextInt(); //User inputs two numbers
10
+y = sct.nextInt();
11
+System.out.println("Before Swapping\nz = "+z+"\ny = "+y);
12
+temp = z; //Swapping is done
13
+z = y;
14
+y = temp;
15
+System.out.println("After Swapping\nz = "+z+"\ny = "+y);
16
+}
17
0 commit comments