Two final notes.
Your conditions don't cover all cases (e.g., what happens if
marks
is
80
?) and redundant (in the second
if
, for instance, you don't need to check for
marks
less than
95
).
I would write the code this way:
#include <stdio.h>
int main()
{
int marks;
printf("Please enter the marks:");
scanf("%d", &marks);
if(marks >= 95)
{
printf("Grade is A+ \n");
}
else if(marks >= 80)
{
printf("Grade is B+ \n");
}
else if(marks >= 70 )
{
printf("Grade is B \n");
}
else
{
printf("Grade is C \n");
}
printf("Thank you!");
return 0;
}