Program on how to check armstrong number

number2=input(“enter the number to be checked for armstrong”)
number=int(number2)
arm=0
number1=number
n=len(number2)
while (number%10)>0:
num=number%10
arm=arm+pow(num,n)
number=number//10
if number1==arm:
print("{} is armstrong".format(number1))
else :
print("{} is not armstrong".format(number1))

this is my code and it’s creating problem
what does this asterisk sign stand for coming beside the cell
.

It means that your cell is busy running in background, here is a link on the topic.

Problem: You are using input() function but jupyter handles it differently(You can find this at this link). Just add a new 2nd line with print statement and try executing code after that.

Also, if you want to write code; you can type it in PreformattedText(ctrl+shift+C).
and in the right hand side section see if the code is formatted properly or not.

Below is the code with print(number2) added in 2nd line.

number2=input("enter the number to be checked for armstrong")
print(number2)            # works with jupyter cell
number=int(number2)
arm=0
number1=number
n=len(number2)
while (number%10)>0:
    num=number%10
    arm=arm+pow(num,n)
    number=number//10
if number1==arm:
    print("{} is armstrong".format(number1))
else :
    print("{} is not armstrong".format(number1))

Hope this helps. :blush:

asterisk ‘*’ it tells that code is running.