How to find the factorial of a number in python without using predefined functions| Write a python program to find the number of occurence of even and odd numbers|Basic computer science python programs
Introduction
In this blog you will Get three programs.
In First Code you will learn to find the factorial of a number in python without using predefined functions. This is a basic approach for finding factorial of a number.
In Second Code you will learn to find the number of occurence of even and odd numbers.
Source code (first)-
num=int(input("Enter a number"))
fact=1
if num<0:
print("factorial doesnt exist")
elif num==0:
print("factorial=1")
else:
for i in range(1,num+1):
fact=fact*i
print("factorial of the given number is:",fact)
#CODE ENDED
Output-
"Hope it helped"
Have anything in mind? Let me
know in the comment section👇
Have anything in mind? Let me
know in the comment section👇