Pages

Friday 18 March 2011

PROGRAM TO INTERCHANGE TWO NUMBERS

DESCRIPTION-:THIS PROGRAM INTERCHANGE THE TWO NUMBER WITHOUT USING THE THIRD VARIABLE.THIS PROGRAM ACCEPT TWO NUMBERS AS INPUT AND GENERATE TWO NUMBER IN OUTPUT BY SWAPPING THEIR VALUES.
PROGRAM-: 
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b;
cout<<"enter  the value of a and b";
cin>>a>>b;
a=a+b;
b=a-b;
a=a-b;
cout<<"\n"<<"after interchanging value of"<<"a="<<a<<"\n"<<"b="<<b;
getch();
}

0 comments:

Post a Comment

 
Copyright (c) 2010 Concepts Of C++. Design by WPThemes Expert

Blogger Templates and RegistryBooster.