0
n=int(input ("enter any number") ) num=int(n) while n>0: r=n%10 C=r**3 sum+=c if sum==num: print("no. is go
Why this program is not running. It stops just after taking the number input
3 odpowiedzi
+ 7
sum=0 #●need of initialization of variable sum
while num>0: #●use num instead of n, edit: if you are making n as int type then you can use n(please don't modify question or modify by typing edit)
r=num%10
c=r**3 #●'c' must be in small
sum+=c
num=num//10 #●need to make change in value of num in each iteration, else num>0 always and loop will never end leading to time limit execedded
0
n=int(input ("enter any number") )
num=int(n)
while n>0:
r=n%10
C=r**3
sum+=c
if sum==num:
print("no. is good")
else:
print("bad no")