c program for swapping of two numbers using temporary variable
#include<stdio.h>intmain(){int a, b, temp;printf("enter the values of a and b:
");scanf("%d%d",&a,&b );printf("current values are:
a=%d
b=%d
", a, b);
temp=a;
a=b;
b=temp;printf("After swapping:
a=%d
b=%d
", a, b);}
// Overcomplicating things lol. Try this#include<stdio.h>intmain(){int x, y;printf("Enter Value of x ");scanf("%d",&x);printf("
Enter Value of y ");scanf("%d",&y);int temp = x;
x = y;
y = temp;printf("
After Swapping: x =%d, y =%d", x, y);return0;}