Website Summary Files Commits Branches @commit @diff @stats
path: root / Week06 / Exercise14.cpp
diff options
context:
space:
mode:
1 files changed, 19 insertions, 0 deletions
-rw-r--r--Week06/Exercise14.cpp19
diff --git a/Week06/Exercise14.cpp b/Week06/Exercise14.cpp
new file mode 100644
index 0000000..86e3a32
--- /dev/null
+++ b/Week06/Exercise14.cpp
@@ -0,0 +1,19 @@
+#include <iostream>
+
+int main() {
+ unsigned int base, tetration;
+ std::cin >> base >> tetration;
+
+ unsigned long long product = 1, pow = base;
+ for (unsigned int tetr = 0; tetr < tetration - 1; tetr++) {
+ for (unsigned int i = 0; i < pow; i++) {
+ product *= base;
+ }
+ pow = product;
+ product = 1;
+ }
+
+ std::cout << pow << std::endl;
+
+ return 0;
+}