Swaping with Two Variable

Sunday, 28 August 2011


#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("Enter the value of a&b");
scanf("%d%d",&a,&b);
printf("\na=%d",a);
printf("\nb=%d",b);


a=a+b;
b=a-b;
a=a-b;


printf("the value after swaping");
printf("\na=%d",a);
printf("\nb=%d",b);
getch();
}


OUTPUT:

Enter the value of a&b4
5
a=4
b=5
the value after swaping
a=5
b=4

No comments:

Post a Comment

 

Blogger news

Blogroll

Enter your email address:

Delivered by FeedBurner

Total Pageviews

Followers

Most Reading