ayanlefarah1987 ayanlefarah1987
  • 06-02-2020
  • Computers and Technology
contestada

In this recitation assignment, will write a complete C program that accepts as input any two integers from the user and swaps both integers using bitwise operators only without a third variable. E

Respuesta :

zoialaraib zoialaraib
  • 06-02-2020

Answer:

#include<iostream>

using namespace std;

int main()

{int num1,num2;

cout<<"enter 2 numbers:"<<endl;

cinn>>num1;

cinn>>num2;

cout<<("value without swapping of num1",num1);

cout<<("value without swapping of num2",num2);

 num1 ^= num2;

   num2 ^= num1;

   num1 ^= num2;

cout<<("num1 after swapping",num1);

cout<<("num2 after swapping,num2);

return 0;

}

Answer Link

Otras preguntas

the students to faculty ratio at a small college is 17:3 the total of students and faculty is 74 how many faculty is there at the college how many students
The length of a rectangle is twice it's width. The perimeter of the rectangle is 126 feet.
Given that 1 joule = 1 newton × 1 meter and 1 volt = 1 joule per coulomb, show that the units newtons/coulomb and volts/meter are equivalent.
1/2(18-5x)=1/3(6-4x)
Devon is trying to find the unit price on a 6 pack of energy drink on sale for $2.99. His sister says that at that price each energy drink would cost just over
Find the multiplier that corresponds to a 10% increase
how do write 65 in expanded form
Is 5/8 greater than less than or equal to 3/8
Is the series equivalent resistor larger than either resistor, or is it smaller?
Which of the following is not true regarding gases?A. When the temp of a gas decreases its volume increases if the pressure is held constant.B. Equal volumes of