We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c505183 commit 69050e7Copy full SHA for 69050e7
DailyCodingProblem/src/DailyExercise/SwapNumber1.java
@@ -0,0 +1,28 @@
1
+package DailyExercise;
2
+
3
+import java.util.Scanner;
4
5
+public class SwapNumber1 {
6
7
+ public static void main(String[] args) {
8
+ // TODO Auto-generated method stub
9
10
+ Scanner sc=new Scanner(System.in);
11
+ System.out.println("Enter the value of a : ");
12
+ int a=sc.nextInt();
13
+ System.out.println("Enter the value of b : ");
14
+ int b=sc.nextInt();
15
16
+ System.out.println("Before swapping a & b : ");
17
+ System.out.println("a = "+a+", b = "+b);
18
19
+ a=a+b;
20
+ b=a-b;
21
+ a=a-b;
22
23
+ System.out.println("After swapping a & b : ");
24
25
26
+ }
27
28
+}
0 commit comments