diff --git a/m1-getting-started-with-programming-in-c/m1-code-challenges-solution/m1-t9-e4.c b/m1-getting-started-with-programming-in-c/m1-code-challenges-solution/m1-t9-e4.c index 4fa0c64..63c99c1 100644 --- a/m1-getting-started-with-programming-in-c/m1-code-challenges-solution/m1-t9-e4.c +++ b/m1-getting-started-with-programming-in-c/m1-code-challenges-solution/m1-t9-e4.c @@ -5,9 +5,10 @@ int main() { // WAP to find out the grade of a student based on marks secured in the exam. // Code challenge solution - char grade = ‘X’; + char grade = 'X'; int marks; puts("Please enter your marks: "); + fflush(stdout); scanf("%d", &marks); if (marks >= 450 && marks <=500) { @@ -25,11 +26,10 @@ int main() { } else { // For negative value or a value greater than 500 puts("Invalid input."); } - -/* If the marks entered by the user is a valid mark between 0 and 500 then ‘grade’ would not be equal to ‘X’ i.e. he has been assigned a valid grade. */ - if (grade != ‘X’) + +/* If the marks entered by the user is a valid mark between 0 and 500 then ‘grade’ would not be equal to ‘X’ i.e. he has been assigned a valid grade. */ + if (grade != 'X') printf("\nYour grade is: %c", grade); return 0; } -