# 1. What is the output for each function?
# a)
def foo():
k = 5
ans = 0
while (k < 10):
ans = ans + k
k = k + 2
print(ans)
foo()
# b)
def goo(x):
k = 5
ans = x
while (k >= 2):
ans = ans + x
k = k - 1
print(ans)
goo(6)
# c)
def hoo(x,n):
while (n > 1):
print(x*n)
n = n - 1
hoo("*",5)
# 2. Write a function called fact(n) that returns the factorial of n.
# The factorial of n is defined as the product of consecutive numbers
# up to n. For example,
# fact(1) = 1 = 1
# fact(2) = 1 x 2 = 2
# fact(3) = 1 x 2 x 3 = 6
# fact(4) = 1 x 2 x 3 x 4 = 24
# fact(5) = 1 x 2 x 3 x 4 x 5 = 120
# ...
# fact(n) = 1 x 2 x 3 x ... x (n-1) x n