/Program to swap two variables without using the third variable in C++.
//Program to swap two variables without using the third variable.
#include
#include
void main()
{
int a,b;
cout<<"Enter the value of a & b:"<
cin>>a>>b;
a=a-b;
b=a+b;
a=b-a;
cout<<"Value of a & b after swapping"<
#include
#include
void main()
{
int a,b;
cout<<"Enter the value of a & b:"<
a=a-b;
b=a+b;
a=b-a;
cout<<"Value of a & b after swapping"<
No comments:
Post a Comment