Key Features

Experienced Teachers
Smart Classes
Regular Test
Study Material

Well qualified teachers with industrial experience.

To visualise or understand topics very easly.

We are organizing online and offline regular test.

We are providing prescribed study material.

Friday, October 30, 2020

Question : Write a C Program to calculate sum of 5 subjects and find percentage.

 

Question :  Write a C Program to calculate sum of  5 subjects and find percentage.

/*
Write a C Program to calculate sum of  5 subjects and find percentage.
*/

#include <stdio.h>
int main()
{
            int s1, s2, s3, s4, s5, sum, total = 500;
float per;
printf("\n Enter marks of 5 subjects : ");
            scanf("%d %d %d %d %d", &s1, &s2, &s3, &s4, &s5);
            sum = s1 + s2 + s3 + s4 + s5;
            printf("\nSum : %d", sum);
            per = (sum * 100) / total;
            printf("\nPercentage : %f", per);
               return (0);
}

OUTPUT :
Enter marks of 5 subjects : 80 70  90  80  80
Sum : 400
Percentage : 80.00

Thank you very much for reading carefully, if you have any other questions, you can share it with us through comments, if this information was important to you, please let us know through comments.

Please do comment and share.
Thank You.

No comments:

Post a Comment