Below is a simple example of a C program to create a student marksheet. This program takes input for the student’s name, roll number, and marks in three subjects, and then calculates the total marks and percentage.
Program :
#include<stdio.h>
#include<conio.h>
int main()
{
int a,b,c,d,e,total;
float average;
printf(“Enter the Marks of First Subject : “);
scanf(“%d”,&a);
printf(“Enter the Marks of Second Subject : “);
scanf(“%d”,&b);
printf(“Enter the Marks of Third Subject : “);
scanf(“%d”,&c);
printf(“Enter the Marks of Fourth Subject : “);
scanf(“%d”,&d);
printf(“Enter the Marks of Fifth Subject : “);
scanf(“%d”,&e);
total=a+b+c+d+e;
printf(“Total marks of the Student : %d/500”,total);
average=total/5;
printf(“\nAverage : %f\n”,average);
if((average>=90)&&(average<=100))
{
printf(“Grade = A++”);
}
else if((average>=85)&&(average<=89))
{
printf(“Grade = A+”);
}
else if((average>=80)&&(average<=84))
{
printf(“Grade = A”);
}
else if((average>=75)&&(average<=79))
{
printf(“Grade = B+”);
}
else if((average>=70)&&(average<=74))
{
printf(“Grade = B”);
}
else if((average>=65)&&(average<=69))
{
printf(“Grade = C+”);
}
else if((average>=60)&&(average<=64))
{
printf(“Grade = C”);
}
else if((average>=55)&&(average<=59))
{
printf(“Grade = D+”);
}
else if((average>=50)&&(average<=54))
{
printf(“Grade = D”);
}
else if((average>=45)&&(average<=49))
{
printf(“Grade = E+”);
}
else if((average>=30)&&(average<=44))
{
printf(“Grade = E”);
}
else
{
printf(“Grade = Fail”);
}
return 0;
}