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

12th Aug 2019, 5:02 PM
Rajat Srivastava
Rajat Srivastava - avatar
3 Respuestas
+ 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
12th Aug 2019, 5:20 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
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")
12th Aug 2019, 5:17 PM
Rajat Srivastava
Rajat Srivastava - avatar