Computer Science, asked by karthikps, 1 year ago

Write a program in c++ to swap three numbers by using third variable.

Answers

Answered by karthik4297
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;}

karthik4297: Code is not looking in good manner dont know why i just copied this from my notepaad.
karthik4297: But still it work fine, u only copy it and save it with .cpp extension.
karthikps: Thanks a lot
Similar questions