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

Programmingway@Eklavya Technosys!: Computer Solutions || Class-4 || Computer for Scho...

Programmingway@Eklavya Technosys!: Computer Solutions || Class-4 || Computer for Scho... :  1) Choose correct one :- 1) The step by step pla...