Header Ads

Header ADS

Swap two number in c++

Swap two number in c++


#include<iostream>
using namespace std;
int main()
{   int num1,num2,samp;
    cout<<"Swao two number:\n";
    cout<<"Input first number:";
    cin>>num1;
     cout<<"Input second number:";
    cin>>num2;
    samp=num2;
    num2=num1;
    num1=samp;
    cout<<"Swapping the first number:"<<num1<<"\n";
    cout<<"Swapping the second number:"<<num2<<"\n";

    return 0;


}

No comments

Powered by Blogger.