Computer Science, asked by prakash27051971, 9 months ago

writea c++ program to swap two numbers​

Answers

Answered by khushimatrimony1989
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 devsingh98011
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