I am new to C programming language and I was trying to run this simple C program , I was expecting the program to go take two char inputs separately and some output based on some if condition , but the program just takes one input and terminates without going through second input , I don't know what I am doing wrong ,please help . this is the output I am getting , below is the code I was trying to run
#include <stdio.h>
int main()
{
char c,d;
printf("Enter your first character : ");
scanf("%c",&c);
if (c=='y')
{
/* code */
printf("y");
printf("\nEntered character is %c\n" ,c);
}
else
{
printf("unknown character");
}
printf("Enter your second character : ");
scanf("%c",&d);
if (c=='a')
{
printf("\nEntered character is %c\n" ,d);
}
else
{
printf("Unknown character");
}
}