top of page

A C program that will calculate the sum of 5 subjects and find their percentage

  • Writer: Nelson John
    Nelson John
  • Nov 26, 2017
  • 1 min read

#include<stdio.h>

int main() {

int s1, s2, s3, s4, s5, sum, total = 500;

float per;

printf("\nEnter 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);

}

Facebook: ayamnelrodinho1@gmail.com

Yahoo: talk2nelsonjohn2dat@yahoo.com

Whatsapp: +2349034595610

PLEASE KINDLY SHARE WITH FELLOW PROGRAMMERS AND ALSO SUBSCRIBE TO MY BLOG PAGE FOR MORE FEEDS.


 
 
 

Comments


bottom of page