diff options
feat(Week05): Add exercises and solutions
1 files changed, 25 insertions, 0 deletions
| -rw-r--r-- | Week05/Exercise05_QuestionSolution.cpp | 25 |
diff --git a/Week05/Exercise05_QuestionSolution.cpp b/Week05/Exercise05_QuestionSolution.cpp new file mode 100644 index 0000000..3714aeb --- /dev/null +++ b/Week05/Exercise05_QuestionSolution.cpp @@ -0,0 +1,25 @@ +#include <iostream> + +/* Отговорът е не, не са нужни масиви. */ + +int main() { + const unsigned int SIZE = 18; + + unsigned int zero_count = 0; + int number; + + for (int i = 0; i < SIZE; i++) { + std::cin >> number; + + if (number == 0) + zero_count++; + else + std::cout << number << ' '; + } + + for (int i = 0; i < zero_count; i++) { + std::cout << 0 << ' '; + } + + return 0; +} |
