diff --git a/app/src/models/__init__.py b/app/src/models/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/app/src/models/compute.py b/app/src/models/compute.py
index 4d1c761..c9d3144 100644
--- a/app/src/models/compute.py
+++ b/app/src/models/compute.py
@@ -21,6 +21,12 @@ def fibonacci(n):
def ackermann(m, n):
return
-
+ @staticmethod
def factorial(n):
- return
+ fact=1
+ if n==0:
+ return 1
+ else:
+ for i in range(1,n+1):
+ fact=fact*i
+ return fact
diff --git a/app/src/views/math_functions.py b/app/src/views/math_functions.py
index d02273c..3eb42d6 100644
--- a/app/src/views/math_functions.py
+++ b/app/src/views/math_functions.py
@@ -31,6 +31,10 @@ def fib_n():
def ack_mn():
return ""
-
+@math.route("/fact", methods=["POST"])
def fact_n():
- return ""
+ n = request.form["fact_n"]
+ if not validations.validate_int(n):
+ # in case of invalid input, return HTTP response code for Bad Request
+ return "Please enter a valid input!", 400
+ return str(Compute.factorial(int(n)))
diff --git a/app/templates/home.html b/app/templates/home.html
index b659a56..874009b 100644
--- a/app/templates/home.html
+++ b/app/templates/home.html
@@ -7,6 +7,12 @@
+
+