Add spaces before each %c
in the sscanf
. This is done to discard all blanks from the stdin
. As these blanks like \n
,spaces will be present in the stdin
, it will be taken by the next call to fgets
and also one %c
because it is also a character. Also use %lf
for double
and not %f
.%f
is for float
.
solved What is wrong in the following program? [closed]