Back To C Single Dimensional Arrays Index
//program to input an integer array of marks in 5 subjects and calculate percentage #include
#include
void main() { int marks[5]; int i,total=0; float percentage; for(i=0;i<5;i++) { printf("\nenter marks in subject %d",i+1); scanf("%d",&marks[i]); total=total+marks[i]; } printf("total number of marks in five subjects are %d",total); percentage=total/5; printf("\npercentage of student is %f",percentage); getch(); }