diff options
Update Pract. Solutions
1 files changed, 8 insertions, 16 deletions
| -rw-r--r-- | pract_SI/Pract. 04/Solutions/task2 - example2.cpp | 24 |
diff --git a/pract_SI/Pract. 04/Solutions/task2 - example2.cpp b/pract_SI/Pract. 04/Solutions/task2 - example2.cpp index 0440873..2d365ba 100644 --- a/pract_SI/Pract. 04/Solutions/task2 - example2.cpp +++ b/pract_SI/Pract. 04/Solutions/task2 - example2.cpp @@ -1,25 +1,17 @@ #include <iostream> -bool isEven(const int num) { +bool isEven(int num) { return !(num % 2); } -bool isZero(const int num) { - return num == 0; -} - -int main() { +int main() +{ int num; std::cin >> num; - if (isZero(num)) { - std::cout << "The number is not ever or odd!"; - } - else { - if (isEven(num)) { - std::cout << "Even"; - return 0; - } - std::cout << "Odd"; - } + + if (isEven(num)) + std::cout << "Even"; + else + std::cout << "Odd"; return 0; }
\ No newline at end of file |
