a=int(input("Enter a number : "))
b=1
for i in range(1,a+1):
b=b*i
print("Factorial : ", b)
Output
Enter a number : 6
Factorial : 720
def fact(n):
if n==1:
return 1
else:
result=n* fact(n-1)
#print("Part factorial : ", result)
return result
fact(4)
Output
24
Author
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.