Write a program in c++ to swap three numbers by using third variable.
Answers
Answered by
1
#include <iostream>using namespace std;
int main() { int a=10; int b= 20; int temp; cout<<"Before swapping: \na = "<<a<<" & b = "<<b<<endl; temp=b;//temp =20 b=a; //b=10 a=temp; cout<<"After swapping: \na = "<<a<<" & b = "<<b; return 0;}
int main() { int a=10; int b= 20; int temp; cout<<"Before swapping: \na = "<<a<<" & b = "<<b<<endl; temp=b;//temp =20 b=a; //b=10 a=temp; cout<<"After swapping: \na = "<<a<<" & b = "<<b; return 0;}
karthik4297:
Code is not looking in good manner dont know why i just copied this from my notepaad.
Similar questions