C program to calculate the total marks, percentage and division of student with C language
#include <stdio.h>
#include <string.h>
void main()
{
int rollno, phy, che, eng, total;
float percentage;
char name[20];
printf("Input the Roll Number of the student :");
scanf("%d", &rollno);
printf("Input the Name of the Student :");
scanf("%s", name);
printf("Input the marks of Physics, Chemistry and English: ");
scanf("%d%d%d", &phy, &che, &eng);
total = phy + che + eng;
percentage = total / 3.0;
printf("\nRoll No : %d\nName of Student : %s\n", rollno, name);
printf("Marks in Physics : %d\nMarks in Chemistry : %d\nMarks in English : %d\n", phy, che, eng);
printf("Total Marks = %d\nPercentage = %5.2f\n", total, percentage);
}
Output:-
Input the Roll Number of the student :54
Input the Name of the Student :laia
Input the marks of Physics, Chemistry and English: 80 60 80
Roll No : 54
Name of Student : laia
Marks in Physics : 80
Marks in Chemistry : 60
Marks in English : 80
FirstTotal Marks = 220
Percentage = 73.33
0 Comments