Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Program to swap values of two variable without using third.
- #include<iostream.h>
- #include<conio.h>
- void main()
- {
- clrscr();
- int a,b;
- cout<<"Enter first number: ";
- cin>>a;
- cout<<"Enter second number: ";
- cin>>b;
- a=a+b;
- b=a-b;
- a=a-b;
- cout<<"The first number is: "<<a<<endl;
- cout<<"The second number is: "<<b;
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment