Input two numbers and swapping these two numbers without using third variable.
#include <stdio.h>
#include <conio.h>
void main( )
{
int m,n;
clrscr ( );
printf ("\n\n\t\t Enter first number...:"); scanf ("%d",&m);
printf ("\n\n\t\t Enter second number..:"); scanf ("%d",&n);
m = m + n;
n = m - n;
m = m - n;
printf ("\n\n\n\t\t\t After Swapping \n\t\t_____________________________ \n");
printf ("\n\t\t The first number is...: %d \n\n\t\t The second number is..: %d",m,n);
getch ( );
}
Click here to contact us
#include <stdio.h>
#include <conio.h>
void main( )
{
int m,n;
clrscr ( );
printf ("\n\n\t\t Enter first number...:"); scanf ("%d",&m);
printf ("\n\n\t\t Enter second number..:"); scanf ("%d",&n);
m = m + n;
n = m - n;
m = m - n;
printf ("\n\n\n\t\t\t After Swapping \n\t\t_____________________________ \n");
printf ("\n\t\t The first number is...: %d \n\n\t\t The second number is..: %d",m,n);
getch ( );
}
Click here to contact us