0
No 2nd input char after 1st input
I want to get first get number then print that num and then get input as character and output that character??? But i get number input and output clearly but not 2nd output for character... https://code.sololearn.com/cVEcGjb3BMho/?ref=app
4 odpowiedzi
0
Suraj Airi are you sure about " int b " then it work between 0 to 127 only . if not change it to " char b " !
if you sure about that then use " getchar() " after " first scanf() " .
see what happens :
when type input for scanf() it takes your input but leaves following blank space or newline character .that newline character is taken by next scanf() , so your second input was discarded !
when you use getchar() after first scanf() , that blank space or newline character readed by this getchar() , so yiur second input will work for second scanf() .
HOPE THIS HELP YOU !
0
Juan Pablo Segundo here is my code
0
Thirt13n ohh thanks that is char b
Thanks for your help