Website Summary Files Commits Branches @commit @diff @stats
path: root / Week05 / Exercise04.cpp
diff options
context:
space:
mode:
1 files changed, 20 insertions, 0 deletions
-rw-r--r--Week05/Exercise04.cpp20
diff --git a/Week05/Exercise04.cpp b/Week05/Exercise04.cpp
new file mode 100644
index 0000000..d7d4b1b
--- /dev/null
+++ b/Week05/Exercise04.cpp
@@ -0,0 +1,20 @@
+#include <iostream>
+
+int main() {
+ unsigned int factorial_max, power;
+ std::cin >> factorial_max >> power;
+
+ unsigned int factorial = 1;
+ for (unsigned int i = 1; i <= factorial_max; i++) {
+ factorial *= i;
+ }
+
+ unsigned int to_power = 1;
+ for (unsigned int i = 1; i <= power; i++) {
+ to_power *= factorial;
+ }
+
+ std::cout << to_power;
+
+ return 0;
+}