Website Summary Files Commits Branches @commit @diff @stats
path: root / pract_SI / Pract. 04 / Solutions / task2 - example2.cpp
diff options
context:
space:
mode:
1 files changed, 25 insertions, 0 deletions
-rw-r--r--pract_SI/Pract. 04/Solutions/task2 - example2.cpp25
diff --git a/pract_SI/Pract. 04/Solutions/task2 - example2.cpp b/pract_SI/Pract. 04/Solutions/task2 - example2.cpp
new file mode 100644
index 0000000..0440873
--- /dev/null
+++ b/pract_SI/Pract. 04/Solutions/task2 - example2.cpp
@@ -0,0 +1,25 @@
+#include <iostream>
+
+bool isEven(const int num) {
+ return !(num % 2);
+}
+
+bool isZero(const int num) {
+ return num == 0;
+}
+
+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";
+ }
+ return 0;
+} \ No newline at end of file