Computer Science, asked by pathakshobha300033, 11 months ago

Write an program that will accept a mark and assign letter grade according to the following grade mark
A =90
B =80 but 90
C = 70 but 80
D =60 but 70
F ^ 60

Answers

Answered by kavithakavi1452
1

Answer:

We can enter mark to our c program and the script will try to find out the grade by using series of if else condition checking. Each if else condition check for mark for a particular grade and if it is TRUE then all other checking ( if else ) are omitted. Here is the sample code.

#include <stdio.h>

int main(void){

int num;

printf("Enter your mark ");

scanf("%d",&num);

printf(" You entered %d", num); // printing outputs

if(num >= 80){

printf(" You got A grade"); // printing outputs

}

else if ( num >=60){ // Note the space between else & if

printf(" You got B grade");

}

else if ( num >=40){

printf(" You got C grade");

}

else if ( num < 40){

printf(" You Failed in this exam");

}

return 0;

}

Similar questions