Back To C Single Dimensional Arrays Index
//program to input an integer array of size 5 from the user and calculate total of the integer array using for loop #include
#include
void main() { int marks[5]; int i,total=0; clrscr(); for(i=0;i<5;i++) { printf("\nenter marks in subject %d",i+1); scanf("%d",&marks[i]); total=total+marks[i]; } printf("total of marks in five subjects is %d",total); getch(); }