+ 2
Problem with C compiler
https://code.sololearn.com/cUi73jczivYc/?ref=app Correct answers are 153, 370, 371, 407, but when I run (compile) this program with SoloLearn compiler, it only prints 370, 371 and 407. I made this program in VScode using gcc compiler, I checked it also with online c compilers and all of them shows correct answer. Where is the problem? missing: Number 153 is an Armstrong number.
1 Resposta
+ 2
Its the problem with the line = 'pow(tmp,3); ', as floating point exponentiation is not very accurate, and the output is floored. For example, try printing pow(5,3) and check the answer, as the compiler prints 124. So, use integral multiplication, or round the output.
https://www.sololearn.com/discuss/1070885/?ref=app
https://www.sololearn.com/discuss/384357/?ref=app
https://www.sololearn.com/discuss/932130/?ref=app
https://www.sololearn.com/discuss/173437/?ref=app