Computer Science, asked by aushpurohit69, 8 months ago

Read two integers as input and swap them using call by reference, without using a third variable.

Answers

Answered by say2shaynapacilx
0

Explanation:

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)

Answered by akm26381
0

Explanation:

#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)

Similar questions