Thursday, July 29, 2021

C++ Program to performed swap of two number without using third variable

C++ Program to performed swap of two number without using third variable

#include<iostream.h>

#include<conio.h>

void main()

{

 int a,b;

 clrscr();

 cout<<"\nEnter First Number : ";

 cin>>a;

 cout<<"\nEnter Second Number : ";

 cin>>b;

 cout<<"\nBefore Swap";

 cout<<"\nFirst Number = "<<a;

 cout<<"\nSecond Number = "<<b;

    a=a+b;

 b=a-b;

 a=a-b;

 cout<<"\nAfter Swap";

 cout<<"\nFirst Number = "<<a;

 cout<<"\nSecond Number = "<<b;

 getch();

}

   

No comments:

Post a Comment

Programmingway@Eklavya Technosys!: JAC Board Computer Examination Sample Questions Hi...

Programmingway@Eklavya Technosys!: JAC Board Computer Examination Sample Questions Hi... : 1) Which of the following is NOT a web service? (...