recent

C Program To Calculate Sum Of 5 Subjects And Find Percentage

C Program To Calculate Sum Of 5 Subjects And Find Percentage

#include<stdio.h>

int main()
{
   int s1, s2, s3, s4, s5,sum, total = 600;
   float percentage;

   printf("Enter marks of 5 subjects : \n");
   scanf("%d %d %d %d %d", &s1, &s2, &s3, &s4, &s5);    /input from user

   sum = s1 + s2 + s3 + s4 + s5;
   printf("Sum of marks : %d\n", sum);

   percentage = (sum * 100) / total;  //Percentage calculate
   printf("Percentage : %f\n", percentage);   //Print Output On screen

}
Powered by Blogger.