Website Summary Files Commits Branches @commit @diff @stats
path: root / Week03 / Exercise07.cpp
diff options
context:
space:
mode:
1 files changed, 18 insertions, 0 deletions
-rw-r--r--Week03/Exercise07.cpp18
diff --git a/Week03/Exercise07.cpp b/Week03/Exercise07.cpp
new file mode 100644
index 0000000..1746447
--- /dev/null
+++ b/Week03/Exercise07.cpp
@@ -0,0 +1,18 @@
+#include <iostream>
+
+int main() {
+ int a, b, c, d;
+ std::cin >> a >> b >> c >> d;
+
+ float average = (float)(a + b + c + d) / 4.0;
+ int sum = a + b + c + d;
+ float inv_sum = 1.0 / (float)a + 1.0 / (float)b + 1.0 / (float)c + 1.0 / (float)d;
+ int product = a * b * c * d;
+ std::cout << average << ' ' << sum << ' ' << inv_sum << ' ' << product;
+ /* В горните сметки можем да пропуснем конвертиранията към float.
+ * Защо?
+ * И какво можем да променим, така че сметките да се нуждаят от конвертиране?
+ */
+
+ return 0;
+}