Could you please let me know why i should command twice for running this C code in Ubuntu terminal gcc compiler. one for entering data another for (if) part
Code:
#include<stdio.h>
int main(){
char p;
printf(" Please enter the grade : ");
scanf(" %c ", &p);
if (p=='A') {
printf("\n your score is excellent");
}
else if (p=='B'){
printf("\n your score is good");
}
else if (p=='C'){
printf("\n your score is fiar");
}
else if (p=='D'){
printf("\n your score is poor");
}
else {
printf("\n you should enetr 'A' or 'B' or 'C' or 'D' ");
}
}