I'm trying to make a C program which accepts two character consecutively and then print them, but I'm getting some anomaly in the output.
The program
#include<stdio.h>
int main()
{
char c1, c2;
printf("\n Enter two characters : ");
scanf("%c%c", &c1, &c2);
printf("\n The the characters are %c and %c ", c1, c2);
return 0;
}
The output
Enter two characters : a
The the characters are a and
In the output without asking for the second character it is directly going to the next printf()
statement. Why is this happening?