Tuesday 31 July 2012

Basic C Programming013

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

1 comment:

Related Posts Plugin for WordPress, Blogger...