+ 1
What is wrong in this code?
https://code.sololearn.com/ccBmJPz8hPO5/?ref=app With the inputs 3, 3 and R, the outputs is supposed to be 1.00 and 4.00. But it is 1.00 and 1.00, and in run.codes, apparently the outputs produced are 10.00 and 13.00.
2 Respuestas
+ 5
On line 11 it should be "%c" instead of "%s", because you declared the variable char type. Also add an interval => " %c". You can see it in the code.
https://code.sololearn.com/c0RP9Av2iVXK/?ref=app
+ 5
Change line 9 from this:
scanf("%s", &sit);
Into this:
scanf(" %c", &sit);
Explanation:
The %s is used for string, you only read one char, so use %c.
Notice there's a space before the %c, it was deliberate, to consume the line feed left behind from previous input. Without the space, variable <sit> is not correctly read.
Hth, cmiiw