Sunday 19 August 2012

c program | if else statement | display student grade n marks | percentage

 Display percentage and grade using if - else if statement example sin c programming

/*How to write C Program to display percentage and grade using if - else if statement*/


#include

void main()

{

int m1,m2,m3,total;


float percent;


printf("Enter marks of three subjects:");

scanf("%d %d %d",&m1,&m2,&m3);


//Calculation of percent

total=m1+ m2 + m3;

percent=total/3;

printf("Percentage: %f\n",percent);




//Checking and displaying grade

if(percent>=70)

printf("----You have got Distinction----");


else if(percent>=60)

printf("----You have got First Class----");


else if(percent>=50)

printf("----You have got Second Class----");


else if(percent>=40)

printf("----You have got Pass Class----");


else

printf("----You have Failed----");



}
Share This
Previous Post
Next Post

FYJC XI standard online admisson Process and declaraton of Merit list . Cut off List For prevous year also . 10 Th Results onlne declaraton Maharashtra Region .

0 comments: