Monday, February 27, 2017

(7)WAP To Enter Two Number And Swap It(use third Variable) in cpp

vProgram
#include<iostream.h>
#include<conio.h>
void main()
{
  int no1,no2,temp;
  clrscr();
  cout<<"\n\t\tEnter First Number:";
  cin>>no1;
  cout<<"\n\t\tEnter Second Number:";
  cin>>no2;
  temp=no1;
  no1=no2;
  no2=temp;
  cout<<"\n\t\t First Number is:"<<no1;
  cout<<"\n\t\t Second Number is:"<<no2;
  getch();
  }

vOutput:

Enter First Number:55
Enter Second Number:66
First   Number Is:66
Second Number is:55

No comments:

Post a Comment