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

To leverage a pre-formated document, what would you use? a New b None of the Above c Templates d Blank Document help me plz
Which word in the sentence is a verb ? Bella is my best friend
PLEASE HELP ASAP!!!!! 8TH GRADE MATH IDKKK!!! 3(7 + 2x) + 3 = 3(5 + x) − 9(x + 1)
Match the words to the appropriate blanks in the sentences. a. For the pair of compounds CO2 or NO2 the one with the highest boiling point is __________ . b.
The rate at which an airplane flew was StartFraction 700 miles over 2 hours EndFraction. How can the unit rate be determined?
if LM=3x-9 and MN=x+1, find LN
Evaluate 0.33. 1) 0.0027 2) 0.027 3) 0.9 4) 2.7
I need help with that​
What was the phonecians most important contribution to society
Lauren would like to find the midpoint of a line segment that has endpoints at (–0.5, 3) and (4, 7.5). Which statements are true? Check all that apply. Lauren c