because of newline character already in stdin , this is happening.
use
scanf(" %c", &cont);
instead of
scanf("%c", &cont);
note one space before %c.
More Related Contents:
- How do you type something on the same line of text in C [closed]
- C program goes into infinite loop with scanf [duplicate]
- Why is scanf() causing infinite loop in this code?
- Disadvantages of scanf
- How to use sscanf in loops?
- Why does scanf ask twice for input when there’s a newline at the end of the format string?
- Simple C scanf does not work? [duplicate]
- C: Multiple scanf’s, when I enter in a value for one scanf it skips the second scanf [duplicate]
- When should I use ampersand with scanf()
- scanf: “%[^\n]” skips the 2nd input but ” %[^\n]” does not. why?
- What does space in scanf mean? [duplicate]
- Reading a line using scanf() not good?
- How to scanf only integer?
- Does scanf() take ‘\n’ as input leftover from previous scanf()?
- printf not printing on console
- Going through a text file line by line in C
- difference between %ms and %s scanf
- How do we test the return values from the scanf() function?
- What does `scanf(“%*[^\n]%*c”)` mean?
- How to read from input until newline is found using scanf()?
- Get scanf to quit when it reads a newline?
- C – trying to read a single char from stdin (and failing) w/ scanf / getchar
- scanf(“%c”) call seems to be skipped
- Strange character after an array of characters
- While-loop ignores scanf the second time
- Using scanf and fgets in the same program?
- What are scanf(“%*s”) and scanf(“%*d”) format identifiers?
- How do you read scanf until EOF in C?
- What is the difference between %f and %lf in C?
- Difference between scanf() and fgets()