writea c++ program to swap two numbers
Answers
Answered by
0
Answer:
#include <iostream>
using namespace std;
int main()
{
int a=5, b=10;
cout<<"Before swap a= "<<a<<" b= "<<b<<endl;
a=a*b; //a=50 (5*10)
b=a/b; //b=5 (50/10)
Explanation:
i think not sure
Answered by
0
Answer:
#include <iostream>
using namespace std;
int main()
{
int a = 5, b = 10, temp;
cout << "Before swapping." << endl;
cout << "a = " << a << ", b = " << b << endl;
temp = a;
a = b;
b = temp;
cout << "\nAfter swapping." << endl;
cout << "a = " << a << ", b = " << b << endl;
return 0;
}
Similar questions
English,
4 months ago
Social Sciences,
4 months ago
Science,
9 months ago
English,
1 year ago
Math,
1 year ago