Swapping two number without 3rd variable
C Program to Swapping two number without 3rd variable
#include<conio.h>
#include<stdio.h>
void main()
{
int num1,num2;
clrscr();
printf("Enter first number : ");
scanf("%d",&num1);
printf("Enter second number : ");
scanf("%d",&num2);
printf("\n\nValue of A: %d and Value of B: %d",num1,num2);
num1=num2+num1;
num2=num1-num2;
num1=num1-num2;
printf("\n\n\n After swaping \n\n");
printf("Value of A: %d and Value of B: %d",num1,num2);
getch();
}
out put:

Comments
Post a Comment