0
Can someone help me to create a program which take two variable and swap them with the help of a temporary variable.
#include<iostream> Using names pace std; Int main() { Int a; Cout<<"enter first number:"<<endl; Cin>>a; Int b; Cout<<"enter second number:"<<endl; Cin>>b; Int c; a = c; b = a; c = b; Cout<<"a ="<<a<<endl; Cout<<"b ="<<b<<endl; return 0; }
2 odpowiedzi
+ 1
#include<iostream>
using namespace std;
int main()
{
int a,b,temp;
cout<<"enter a and b values";
cin>>a>>b;
temp=a;
a=b;
b=temp;
cout<<" a = "<<a;
cout<<" b= "<<b;
return 0;
}
0
c = a;
a = b;
b = c;