Professional Documents
Culture Documents
OUTPUT:
Q3: Program to print the factorial number of input?
INPUT #Python Program to find Factorial number
n=int(input("Enter any number to find factorial --> "))
fact=1
for i in range(n,0,-1):
fact=fact*i
print " Factorial number is --> ",fact
OUTPUT:
Q4: Python Program to find a number is Even or Odd?
INPUT # Program to check a number is Even & Odd
n=int(input("Enter a number --> "))
if n%2==0:
print "This number is even number --> ",n
else:
print "This number is odd number --> ",n
OUTPUT:
Q5: Python Program to enter a range of sum of
natural number?
INPUT # to find out sum of natural number till the range input
n=int(input("Enter a range --> "))
sum=0
for i in range(1,n+1):
sum=sum+i
print "The sum of natural number till the range is --> ",sum
OUTPUT: