0
A C++ Program To Swap Two Numbers x and y if x is greater than y. Output both numbers
#include <cstdlib> #include <iostream> #include <math.h> using namespace std; int main() { int x, y; cout << " Enter the value of x :"; cin >> x; cout << " Enter the value of y :"; cin >> y; if (x > y) { cout << "The value of x " << x << " Becomes smaller :"; } else{ cout << "The value of y " << y << "Becomes the same :"; } return 0; } Please I Need A Helping Hand 👆
1 Odpowiedź
+ 1
#include <iostream>
using namespace std;
int main() {
int a, b, c;
cout << "please enter 1th number: " << endl;
cin >> a;
cout << "please enter 2th number: " << endl;
cin >> b;
c = a;
a = b;
b = c;
cout << "after changing, a = " << a << endl << "b = " << b << endl;
return 0;
}