Write a CPP Program To Swap Two Numbers
1: #include<iostream.h>
2: #include<stdio.h>
3: int main()
4: {
5: int a,b,c;
6: cout << "Enter 2 numbers" << endl;
7: cin>>a>>b;
8: cout<< "Initially"<<endl;
9: cout<< "a = "<<a<<endl;;
10: cout<< "b = "<<b<<endl;
11: c=a;
12: a=b;
13: b=c;
14: cout<< "Swapped"<<endl;
15: cout<< "a = "<<a<<endl;;
16: cout<< "b = "<<b<<endl;
17: }
No comments:
Post a Comment