Thursday, July 29, 2021

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

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

#include<iostream.h>

#include<conio.h>

void main()

{

 int t,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;

    t=a;

 a=b;

 b=t;

 cout<<"\nAfter Swap";

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

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

 getch();

}

   

No comments:

Post a Comment

12th January Swami Vivekanand Jayanti: National Youth Days

The day serves as a reminder to the youth of India to remain steadfast in their goals and contribute positively to society. Swami Vivekanand...