Skip to main content

Array simple example 1

#include<stdio.h>
int main()
{
    int marks[5];
    marks[0]=98;
    marks[1]=95;
    marks[2]=93;
    marks[3]=97;
    marks[4]=91;
    printf("The marks of student [0] is %d\n ",marks[0]);
    printf("The marks of student [1] is %d\n ",marks[1]);
    printf("The marks of student [2] is %d\n ",marks[2]);
    printf("The marks of student [3] is %d\n ",marks[3]);
    printf("The marks of student [4] is %d\n ",marks[4]);
    printf("The average marks of students is %d\n",
    (marks[0]+marks[1]+marks[2]+marks[3]+marks[4])/5);
    return 0;
}

Comments