C Programming
Computer Programming

Program in c to calculate sum of 5 subjects and find percentage



Write a Program in c to calculate sum of 5 subjects and find percentage

\* C Program to to calculate sum of 5 subjects and find percentage *\

# include < stdio.h >
int   main( )
{

int   s1, s2, s3, s4, s5, sum  ;
float   avg  ;
printf(" Enter the marks of five subjects : ") ;
scanf("%d %d %d %d %d ", &s1, &s2, &s3, &s4, &s5 ) ;
sum = s1 + s2 + s3 + s4 + s5  ;
avg = sum / 5  ;
printf("\n Total Marks in 5 subjects : ") ;
printf(" %d ",  sum) ;
printf("\n Percents of 5 subjects : ") ;
printf(" %f ",  avg) ;
return ( 0 );

}

Output of Program:

Output of Program in C to calculate sum of 5 subjects and find percentage