Tuesday, 4 October 2016

Program for Swapping 2 nos. using two variables .



#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b;
cout<<“a= “;
cin>>a;
cout<<“b= “;
cin>>b;
a=a+b;
b=a-b;
a=a-b;
cout<<“a=”<<a<<“\n”;
cout<<“b=”<<b;
getch();
}

No comments:

Post a Comment

Basic Implementation of Array as a Pointer

#include<iostream.h> #include<conio.h> void main() { clrscr();   int arr[5];   cout<<"Enter 5 nos. ";   f...