a simple computer program to swap two numbers by using the third number
Answers
Answered by
1
hi cherry commment in my answer
cherry9017:
hi
Answered by
1
Hey,
#include <stdio.h>
int main()
{ int x, y, temp;
cout<<("Enter the value of x and y\n");
cin>>("%d%d", &x, &y);
cout<<("Before Swapping\nx = %d\ny = %d\n",x,y);
temp = x;
x = y;
y = temp;
cout<<("After Swapping\nx = %d\ny = %d\n",x,y);
return 0;
}
HOPE IT HELPS:-))
#include <stdio.h>
int main()
{ int x, y, temp;
cout<<("Enter the value of x and y\n");
cin>>("%d%d", &x, &y);
cout<<("Before Swapping\nx = %d\ny = %d\n",x,y);
temp = x;
x = y;
y = temp;
cout<<("After Swapping\nx = %d\ny = %d\n",x,y);
return 0;
}
HOPE IT HELPS:-))
Similar questions