#include <stdio.h> #include <conio.h> main() { int x, y, temp; printf("Enter the value of x and y "); scanf("%d %d", & x, & y); printf("Before Swapping\nx = %d\ny = %d\n",x,y); temp = x; x = y; y = temp; printf("After Swapping\nx = %d\ny = %d\n",x,y); getch(); return 0; } OUTPUT: Enter the value of x and y 2 4 Before Swapping x = 2 y = 4 After Swapping x = 4 y = 2 C Program To Swap Two Numbers Without Using Temp Variable. #include <stdio.h> main() { int a, b; printf("Enter two numbers to swap "); scanf("%d %d", & a, & b); a = a + b; b = a - b; a = a - b; printf("a = %d\nb = %d\n",a,b); return 0; } OUTPUT: Enter two numbers to swap 2 4 a = 4 b = 2 C ...
All HR and Technical interview questions with answers for freshers and experienced professional. It helps job seekers who are about to attend interviews.