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 difference between three times a number and seven is twenty. what is the number?
Multiply:(x 3)(3x - 6)
Which of the following explains why European countries would offer incentives to persuade people to move to the colonies?
in the exercises 6-14, X=12, Y=10, Z=24. write each ratio in simplest form 6. x to y 7. z to x 8. x+y to z 9. x/x+z 10. x+y/z+y 11. y-z/x-y 12. x : y : z 13.
Write two expressions that the solution is 19
Diatomic molecules will be ______ when they are composed of only one element. Nonpolar Polar
if terry is doing 2 sets of 6 repetitions at 50 pounds of a bench press in order to improve her muscular strength in the chest area, how many sets would show an
Given the parent functions f(x) = log3 (5x − 5) and g(x) = log3 (x − 1), what is f(x) − g(x)?
In the early 1970's, Canada Post started using six-character postal codes. Each postal code uses three letters and three digits in an alternating pattern. How m
What is 5/9 of 45? Please help!