In examination the grades are awarded to the students in science according to the average marks obtained in the examination :
Marks Grades
80% and above Distinction
60% or more but less than 80% First Division
45% or more but less than 60% Second Division
40% or more but less than 45% Pass
less then 40% Promotion not granted
Write a program to input name and marks in physics, chemistry and biology .Calculate the average marks. Display the name, average marks and the grade obtained.
it is a scanf program
Answers
Answer:
#include <stdio.h>
int main() {
char name[15];
float physicsMarks, chemistryMarks, biologyMarks;
printf("Enter name: ");
fgets(name, 15, stdin);
printf("Enter marks of physics: ");
scanf("%f", &physicsMarks);
printf("Enter marks of chemistry: ");
scanf("%f", &chemistryMarks);
printf("Enter marks of biology: ");
scanf("%f", &biologyMarks);
float averageMarks = (physicsMarks + chemistryMarks + biologyMarks) / 3.0;
printf("\nName: %sAverage Marks: %.2f\n", name, averageMarks);
if (averageMarks >= 80) {
printf("Distinction\n");
} else if (averageMarks >= 60) {
printf("First Division\n");
} else if (averageMarks >= 45) {
printf("Second Division\n");
} else if (averageMarks >= 40) {
printf("Passed\n");
} else {
printf("Promotion Not Granted\n");
}
return 0;
}
Explanation:
Plz mark it as the brainliest