+ 1
geeks, please whats wrong with this? C language sum
https://code.sololearn.com/cNsxyiPGw0wh/?ref=app In playground maybe is not possible to printf 2 inputs? indnt understand where I'm worng, please if someone can help me understand what's wrong, I prefer a tip instead a solution, thank u all have nice day
5 Answers
+ 1
i input in different ways two numbers and playground code seems like is broken , no output on screen, even if the sum is 21
+ 1
thank u much
- 1
Your code is not SoloLearn compliant.
Edited it to be SoloLearn compliant:
https://code.sololearn.com/c8V8RyjkygmO/?ref=app
1. Removed hidden chars
2. Included std lib
However it still does not do console, so valid input must be given to terminate else runs forever. You can add a counter to stop.
Input in pop up:
2 8
5 4
1 20
Basically the infinite loop is not your fault but SoloLearn, since they do not support direct console input, like remote terminal I used before.
However as Jamie pointed out there still is some logic issues:
1. Do you want to loop until the number sum is or isnāt 21?
A. If so then you should use !=
B. However whether or not it should be 21, your logic will always display the losing (try again) message. Hence I added the if statement before the losing statement.
Keep up the good work!