if else if program in C.

 

01 #include<stdio.h>
02
03 int main()
04 {
05 int marks;
06 printf("Enter Marks to know your GRADE : ");
07 scanf("%d",&marks);
08 if(marks<35)
09 {
10 printf("Grade 'F'");
11 }
12 else if(marks>=35 && marks<=40)
13 {
14 printf("Grade 'D'");
15 }
16 else if(marks>=41 && marks<50)
17 {
18 printf("Grade 'C'");
19 }
20 else if(marks>=50 && marks<60)
21 {
22 printf("Grade 'B'");
23 }
24 else if(marks>=60 && marks<70)
25 {
26 printf("Grade 'B+'");
27 }
28 else if(marks>=70 && marks<80)
29 {
30 printf("Grade 'A'");
31 }
32 else // marks>80
33 {
34 printf("Grade 'A+'");
35 }
36 return 0;
37 }
 
 OUTPUT :

Enter Marks to know your GRADE : 78
Grade 'A'

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.