0% found this document useful (0 votes)
37 views3 pages

Given Number Is Odd or Even

The document contains code snippets that check if a number is even or odd, prime or not, calculates factorial, Fibonacci series, and checks if a number is Armstrong. It takes a number as input, performs various checks like checking for divisibility, iterating through loops, calculating factorials and series, and compares the results to determine properties of the number.

Uploaded by

ramu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views3 pages

Given Number Is Odd or Even

The document contains code snippets that check if a number is even or odd, prime or not, calculates factorial, Fibonacci series, and checks if a number is Armstrong. It takes a number as input, performs various checks like checking for divisibility, iterating through loops, calculating factorials and series, and compares the results to determine properties of the number.

Uploaded by

ramu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Given number is odd or even:

a=int(input("Enter the number:"))

if a%2==0:

print("the given number is Even number")

else:

print("the given number is Odd number")

Given number is odd or even

t=eval(input("Enter the list numbers:"))

for x in t:

if x%2==0:

print(x,"is even number")

else:

print(x,"is odd number")

Given number is prime number or not

a=int(input("enter the value"))

for i in range(2,a):

if (a % i)==0:

print(a,"is not a prime number")

break

else:

print("the given number is prime number")

program for factorial

a=int(input("enter the factorial number:"))

b=1

for i in range(1,a+1):

b=b*i

print("the value of given number is:",b)


Fibonnosis series

num=int(input("enter the fibanosis series number:"))

a=0

b=1

for i in range(0,num+1):

c=a+b

a=b

b=c

print("the series of given number is:",c)

Given number is Armstrong or not:

def armstrong1(num):

rem=0

sum=0

while(num>=1):

rem=num%10

sum=rem*rem*rem+sum

num=int(num/10)

return sum

n=int(input("enter a number"))

sum1=armstrong1(n)

if n==sum1:

print(n,"is an Armstrong number.")

else:

print(n,"is not Armstrong number.")

You might also like