Friday, September 28, 2018

Write a program to swap the values of two variables in C++?

#include<iostream.h>
#include<stdio.h>
#include<conio.h> 
int main()
{
 int a,b,temp;
 cout<<"\nEnter two numbers : ";
 cin>>a>>b;
 temp=a; 
 a=b;
 b=temp;
 cout<<"\nAfter swapping numbers are : ";
 cout<<a<<" "<<b;

 
 return 0;
}

No comments:

Post a Comment