My code isn't asking for the second %c input and just printing the result. of the first and printing the next question after.
This is the assignment: Students can take Programming module if they are from SOE or they have passed Math. Otherwise, they cannot take the module. Write a program to allow students to check their eligibility. Your program must have only one if-else statement and must use the OR logical operator in the condition. Your program must be able to produce the sample outputs given below. Note that the values underlined are the input data.
this is the code i wrote:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char soe, math;
printf("Are you from SOE [y/n]? ");
scanf("%c", &soe);
printf("Did you pass Math [y/n]? ");
scanf("%c", &math);
if(soe == 'y' || math == 'y'){
printf("OK, you can take Programming");
}
else{
printf("Sorry, you cannot take Programming");
}
}
Are you from SOE [y/n]? y
Did you pass Math [y/n]? OK, you can take Programming
it immediately prints the 2nd printf after the 1st input and doesnt ask for a second input