Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeMartinRince authored Dec 20, 2024
1 parent 630e1e0 commit 80a70d0
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions Day-17/joe.m.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""
AUTHOR : JOE MARTIN RINCE
"""
def factorial(n):
if n==0 or n==1:
return 1
else:
return n*factorial(n-1)

print(factorial(6))

def fibonacci(m):
if m==0:
return 0
elif m==1:
return 1
else:
return fibonacci(m-1)+factorial(m-2)
print(fibonacci(5))

def sum_of_digits(l):

if l < 10:
return l
else:

return l % 10 + sum_of_digits(l// 10)


print("Sum of digits:", sum_of_digits(123456))

0 comments on commit 80a70d0

Please sign in to comment.