I am trying to work out why the second scanf is not working for me. Here is the code:
#include <stdio.h>
int main() {
char n;int p;
printf("Enter the number: ");
scanf("%d",&p);
if(p==1) {
printf("Enter a character: ");
scanf("%c",&n);
}
}
In this program the second scanf("%c",&n)
is not working. What am I doing wrong? The output of above program is:
Enter a number: 1
Enter a charter:
It is coming out of compiler.