Write a program which calculate your grade while entering marks .

 

Hello Friend’s

Today we are learn how to make programme which calculate grade while entering marks with the help of ‘if-else’ ladder in  ‘c language’

 we know that ‘If’ keyword run when function is true and ‘if’ is not run then 'else' going to run . here in this program we use arethematic (+,-,*,/), relational (>,<,=) and logical operater  (&&,||)

Here in this programme we put total marks per subject is 30 (if you want to change it , you can)

 


 

We know that sintex of ‘if-else’ ledder, that is


if (/* condition */)
{
     /* code */
}
else if (/* condition */)
{
     /* code */
}
else
{
     /* code */
}


Now we are write  our programme which calculate  grade while entering marks

 "friend's incase you are watching this content in mobile rotate your mobile if find any difficulty to seen source code"


#include<stdio.h>
int main(){
 printf("Enter the marks To know you are pass or fail\n");
 int FCP;
 printf("enter the marks of FCP=");
 scanf("%d",&FCP);
 if(FCP>30){
 printf("marks of per subject is 30 , enter valid marks\n");
    }
 else if(FCP==12){
printf("you are passed with grade D\n");
    }
else if(FCP>=13 && FCP<=20){
printf(" you are passed with grade C\n");
    }
else if(FCP>=21 && FCP<=25){
printf("you are passed with grade B\n");
    }
else if(FCP>=25 && FCP<=30){
printf(" you are passed with grade A\n");
    }
    return 0;
}

Output:-

Enter the marks To know you are pass or fail

enter the marks of FCP=28

 you are passed with grade A

 

 

0 Comments