# C program to find the grade obtained by reading marks of student

In this example, we learn how to write C program to find the grade obtained by reading marks of students. We will write the C program to find the grade obtained of student. Write a c program to input the roll number and five subjects marks from the user and find grade obtained by reading marks of student. How to find grade from marks of student in c programming. Logic to find grade from marks of students.

#### C program to find the grade obtained by reading marks of student

For example, if a user enters the roll no.: 182540 and marks in 5 subjects are 92,80,94,89 and 91 then the output will be:

Enter the roll no:-182540
Enter marks in 5 subject

92
80
94
89
91

rollno of student =182540

marks in subject1=92
marks in subject2=80
marks in subject3=94
marks in subject4=89
marks in subject5=91
total marks in subject=446
total percentage in subject=89.199997
``````
#include<stdio.h>
int main()
{
int i,m1,m2,m3,m4,m5,rollno,tot;
float perc;

for(i=1;i<=5;i++)

{

printf("\n Enter the roll no:-");

scanf("%d",&rollno);

printf("\nenter marks in 5 subject");

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

tot=m1+m2+m3+m4+m5;

perc=(float)(tot/5.0);

if(perc>=90)

{

}

else

{

if(perc>=80)

{

}

else

{

if(perc>=70)

{

}

else

{

if(perc>=50)

{

}

else

{

if(perc>=36)

{

}

else

{

}

}

}

}

}

printf("\nrollno of student =%d",rollno);

printf("\nmarks in subject1=%d",m1);

printf("\nmarks in subject2=%d",m2);

printf("\nmarks in subject3=%d",m3);

printf("\nmarks in subject4=%d",m4);

printf("\nmarks in subject5=%d",m5);

printf("\ntotal marks in subject=%d",tot);

printf("\ntotal percentage in subject=%f",perc);