Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
}