From a71a5027c9c98a11e1790c78467c39b007985ad4 Mon Sep 17 00:00:00 2001 From: FatimaSaeed123 <68647842+FatimaSaeed123@users.noreply.github.com> Date: Sun, 18 Sep 2022 16:17:57 +0500 Subject: [PATCH] Create q1_sol.py --- q1_sol.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 q1_sol.py diff --git a/q1_sol.py b/q1_sol.py new file mode 100644 index 0000000..4b742c0 --- /dev/null +++ b/q1_sol.py @@ -0,0 +1,14 @@ +def find_factorial_sum(n): + fact = 1 + for i in range(1,n+1): + fact = fact*i + print("The factorial is: ", fact) + + sum = 0 + for x in str(fact): + sum += int(x) + print("The sum of digits of factorial is: ", sum) + + +n = 100 +find_factorial_sum(n)