What's is the error in this program amstrong number | SoloLearn: Learn to code for FREE!

0

What's is the error in this program amstrong number

a= int(input('enter the number :')) total=0 temp=a while a>0 : b=a%10 total= total+b**3 temp=temp//10 print('total value is %d',total) if a==total : print('It is an amstong number') else : print(It is not an amstrong number )

3/18/2020 3:00:53 PM

Ragul P

3 Answers

New Answer

0

Output screen shows indentation error

+8

It's because the indentation is different for all lines inside the loop. Make indentation same (4 spaces) for all lines inside loops and control statements.

+6

Change the condition to while temp>0 as you are reducing the value of temp inside the loop. In your case, the loop goes on forever I think.