Website Summary Files Commits Branches @commit @diff @stats
path: root / Week05 / Exercise05_QuestionSolution.cpp
diff options
context:
space:
mode:
1 files changed, 25 insertions, 0 deletions
-rw-r--r--Week05/Exercise05_QuestionSolution.cpp25
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;
+}