Free help with homework

Why join Brainly?

  • ask questions about your assignment
  • get answers with explanations
  • find similar questions

Write a program to take two values and interchange them by using an extra variable

in which programming language do u want it ?


Int main()
int a,b,temp;
cout<<"enter 1st value";
cout<<"enter 2nd value";

temp=a;//value of a stored into temp variable
a=b;//value of b is stored into a,now if b=1,then both a and b contain 1;
b=temp;//value of temp(or a) is send into b

cout<<"swaped values are:-/n"<<a<<b;
cout<<"/nthank you";

0 0 0
The Brain
  • The Brain
  • Helper
Not sure about the answer?
Learn more with Brainly!
Having trouble with your homework?
Get free help!
  • 80% of questions are answered in under 10 minutes
  • Answers come with explanations, so that you can learn
  • Answer quality is ensured by our experts