A C++ Program To Swap Two Numbers x and y if x is greater than y. Output both numbers | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
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 👆

30th Apr 2020, 9:45 AM
Nathaniel Kwaku Awenate
Nathaniel Kwaku Awenate - avatar
1 ответ
+ 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; }
30th Apr 2020, 9:48 AM
Rohit