Saturday, 26 September 2015

Program to find swapping of two numbers

/*Program to find swapping of two numbers*/
#include<conio.h>
#include<stdio.h>
void main()
{
     int a=10,b=20,temp;
     clrscr();
     printf("before swapping a=%d and b=%d\n",a,b);
     //temp=a;
     //a=b;
    //b=temp;
     a=a+b;
     b=a-b;
     a=a-b;
    printf("after swapping a=%d and b=%d",a,b);
    getch();
}


No comments:

Post a Comment