num = int(input("Enter a number to check if it is Armstrong Number"))
n = num
arm_sum = 0
while(n>0):
mod = n % 10
n = int(n/10)
arm_sum += pow(mod, 3)
if arm_sum == num:
print("it's an armstrong number")
else:
print("Number is NOT an armstrong number")
it's an armstrong number
prev_num = 0
pres_num = 1
num = int(input("Enter a number: "))
cur_num = prev_num+pres_num
fib_list = []
fib_list.append(prev_num)
fib_list.append(pres_num)
while(cur_num <= num):
prev_num = pres_num
pres_num = cur_num
fib_list.append(cur_num)
cur_num = prev_num + pres_num
print(fib_list)
if num in fib_list:
print('given number is IN fibonacci series')
else:
print('given number is NOT IN fibonacci series')
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144] given number is IN fibonacci series