Can someone pls tell me why the program shows time limit exceeded? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone pls tell me why the program shows time limit exceeded?

^ the queation above ^ https://code.sololearn.com/cS1ToHbPTU5E/?ref=app

15th Apr 2017, 1:52 PM
Zaha
Zaha - avatar
4 Answers
+ 8
You should (I would) do it with while inside if. if (n!=0) { while (/*your condition*/) { //your while loop } } And check your code's logic, it seems for me like it outputs just the last digit of the input
15th Apr 2017, 2:40 PM
Dinmukhamed Mailibay
Dinmukhamed Mailibay - avatar
+ 1
ty i forgot to ad an n/=10 and now it works :D
15th Apr 2017, 2:42 PM
Zaha
Zaha - avatar
0
if i replace the while with an if will it be ok?
15th Apr 2017, 2:07 PM
Zaha
Zaha - avatar
0
i want to do the figure sum( and yea dats an old photo of chiby lisandra, although i had never played her lol xD)
15th Apr 2017, 2:17 PM
Zaha
Zaha - avatar