Skip to content

Commit b77a52a

Browse files
Merge pull request seeditsolution#45 from SagnikBagchi23/patch-1
Create Swap 2 numbers
2 parents 807b77a + 9a1dfe6 commit b77a52a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Swap 2 numbers

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// C program to swap two variables
2+
#include <stdio.h>
3+
4+
int main()
5+
{
6+
int x, y;
7+
printf("Enter Value of x ");
8+
scanf("%d", &x);
9+
printf("\nEnter Value of y ");
10+
scanf("%d", &y);
11+
12+
int temp = x;
13+
x = y;
14+
y = temp;
15+
16+
printf("\nAfter Swapping: x = %d, y = %d", x, y);
17+
return 0;
18+
}

0 commit comments

Comments
 (0)