Programming

C – Find Total, Percentage and Division of Student

Write a program to find the division of a student by asking 5 subjects numbers Write a program to find Total and percentage by entering 5 subject marks of a student.

C Code

#include <stdio.h>
#include <conio.h>
void main()
{
int sub1, sub2, sub3, sub4, sub5, total;
float per;

printf("Enter marks of 5 subjects:");
scanf("%d%d%d%d%d",&sub1,&sub2, &sub3, &sub4, &sub5);

total = sub1+sub2+sub3+sub4+sub5;
per = total/5;

printf("nTotal Marks: %d",total);
printf("nTotal Percentage: %f", per);

if(per>=80)
printf("nDistinction");
else if(per>=60)
printf("nFirst Division");
else if(per>=50)
printf("nSeocnd Division");
else if(per>=40)
printf("nThird Division");
else
printf("nFail");
getch();
}

Output

Tuts

About Author

Tutsmaster.org provides tutorials related to tech and programmings. We are also setting up a community for the users and students.