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

12th May 2021, 7:23 AM
Suraj Airi
4 ответов
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 !
12th May 2021, 8:09 AM
Giriraj Yalpalwar
Giriraj Yalpalwar - avatar
0
Juan Pablo Segundo here is my code
12th May 2021, 7:27 AM
Suraj Airi
0
Thirt13n ohh thanks that is char b Thanks for your help
12th May 2021, 9:14 AM
Suraj Airi