Hey guys !!!
write a program to enter the marks of 5 subjects.Calculate
its total and average
and give grades as per it (>90-A1; 80-90 -A2 ; 70-80-B1; 60-70-B2 ;50-60-C1 ;40-50-C2; <40- F)
Answers
Answer:
giving it in C
Logic to find total, average and percentage
Step by step descriptive logic to find total, average and percentage.
Input marks of five subjects. Store it in some variables say eng, phy, chem, math and comp.
Calculate sum of all subjects and store in total = eng + phy + chem + math + comp.
Divide sum of all subjects by total number of subject to find average i.e. average = total / 5.
Calculate percentage using percentage = (total / 500) * 100.
Finally, print resultant values total, average and percentage.
/**
* C program to calculate total, average and percentage of five subjects
*/
#include <stdio.h>
int main()
{
float eng, phy, chem, math, comp;
float total, average, percentage;
/* Input marks of all five subjects */
printf("Enter marks of five subjects: \n");
scanf("%f%f%f%f%f", &eng, &phy, &chem, &math, &comp);
/* Calculate total, average and percentage */
total = eng + phy + chem + math + comp;
average = total / 5.0;
percentage = (total / 500.0) * 100;
/* Print all results */
printf("Total marks = %.2f\n", total);
printf("Average marks = %.2f\n", average);
printf("Percentage = %.2f", percentage);
return 0;
}
Answer:
ache hai hm tum kaisi hooo