First Exercise

This commit is contained in:
2025-02-20 23:51:20 +01:00
parent 2b700071aa
commit d580b385e5
27 changed files with 207 additions and 36 deletions

View File

@@ -0,0 +1,22 @@
#include <iostream>
int main() {
int a;
std::cin >> a; // get input of for a
if (a >= 1000) { // check if input is greater than 1000
int b = a % 10; // get last digit
a /= 10;
int c = a % 10; // get second digit
a /= 10;
int d = a % 10; // get first digit
std::cout << d << " " << c << " "
<< b; // output first, second, and last digit
} else { // if input not greater than 1000 return 0
return 0;
}
return 0;
}