From f83bf0ab9f950544233db29d826f2ffeded9ea89 Mon Sep 17 00:00:00 2001 From: hiba007 <37494476+hiba007@users.noreply.github.com> Date: Sun, 18 Sep 2022 19:48:38 +0500 Subject: [PATCH] Update solution.py My solution --- Q1/solution.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Q1/solution.py b/Q1/solution.py index 4429a19..574f393 100644 --- a/Q1/solution.py +++ b/Q1/solution.py @@ -1 +1,24 @@ ## Add code below with answer clearly stated + +def factorial_sum(n): + + if n == 1: + return 1 + + return n * factorial_sum(n-1) + + +if __name__ == "__main__": + + n = 10 + res = factorial_sum(n) + + sum_digits = 0 + + for i in str(res): + + sum_digits += int(i) + + print(sum_digits) + +#648 is the answer of sum of digits of 100!.