feat: completed exercise 17 and 18

This commit is contained in:
baphim
2026-10-12 17:48:57 -04:00
parent f903e12ca3
commit ba8da6b2b5
2 changed files with 29 additions and 2 deletions
+11 -1
View File
@@ -1,4 +1,14 @@
"""
Write a program to use a loop to find the factorial of a given number (e.g., 5!). The factorial of N is the product
of all integers from 1 to N.
"""
"""
# Set input number and factorial variables
num = 5
factorial = 1
# Iterate through range of 1 to num var + 1 and multiply by i
for i in range(1, num + 1):
factorial = factorial * i
# Print resulting factorial
print(factorial)