Monday, February 27, 2017

(8)WAP To Enter Two Number And Swap It(Don’t Use Third Variabal) in cpp

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

vOutput:

Enter First Number:75
Enter Second Number:36
First   Number Is:36
Second Number is:75

No comments:

Post a Comment