diff --git a/Problems/Problem_4/prob4.py b/Problems/Problem_4/prob4.py new file mode 100644 index 0000000..fe86c23 --- /dev/null +++ b/Problems/Problem_4/prob4.py @@ -0,0 +1,15 @@ +def fact(x): + if (x == 1): + return 1 + return x*fact(x-1) + +def sumOfdig(n): + sum = 0 + while (n>0): + temp = n%10 + n = n//10 + sum += temp + return sum + +num = int(input("Enter a number : ")) +print(sumOfdig(fact(num)))