top of page
shishantpandey

CHEEK GRADE IN C PROGRAM

Updated: Aug 8, 2022




#include <stdio.h>




int main() { /*here is a

simply code that tell your grade accordinh to your number c=lees than 30 b=more than or equal to 30 but less than 60 a=more than or equal to 60 but less than 90 A=more than or equal to 90 but less than 100 */



 

char grade4 = 'c';


char grade3 = 'b'; char grade2 = 'a'; char grade1 = 'A'; int num; printf("enter your marks"); scanf("%d", &num); if (num




< 0)


{ printf("entre a valid number"); } else if (num >=0 && num <=30) { printf("%c", grade4); } else if (num >= 30 && num < 60) {



printf("%c", grade3); } else if (num >= 60 && num <= 80) { printf("%c", grade2); } else if (num > 80 && num <= 100) { printf("%c", grade1); } else




{


printf("enter a valid number"); } return 0; }

 

OUTPUT


enter your marks 60

a



enter your marks 90

A



5 views0 comments

Recent Posts

See All

Comentários


Post: Blog2_Post
bottom of page