Header Ads

Header ADS

Write a C program to enter marks of five subjects and calculate total, average and percentage.

 

#include <stdio.h> int main() { float eng, phy, chem, math, comp; float total, average, percentage;

printf("Enter marks of five subjects: \n"); scanf("%f%f%f%f%f", &eng, &phy, &chem, &math, &comp); total = eng + phy + chem + math + comp; average = total / 5.0; percentage = (total / 500.0) * 100; printf("Total marks = %.2f\n", total); printf("Average marks = %.2f\n", average); printf("Percentage = %.2f", percentage); return 0; }

No comments

Powered by Blogger.