Final Practical Exam Python Que 1

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

FINAL PRACTICAL WORKSHEET

Name: KUNAL BADODIA Section/Group: 712-A


UID: 20BCS5860 Subject: Programming in Python Lab

Branch: BE CSE Semester: 4th

Q1) Write a program in Python to check whether an integer is Armstrong number or


not.

CODE :

#KUNAL BADODIA 20BCS5860


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

sum = 0
temp = num
while temp > 0:
digit = temp % 10
sum += digit ** 3
temp //= 10

if num == sum:
print(num,"is an Armstrong number")
else:
print(num,"is not an Armstrong number")

Output:=

You might also like