REPLACING A VALUE OF AN ARRAY

num[2]=30;

printf(“%d”, num[2]);

//output:30

A simple program using array

#include<stdio.h>

void main()

{

  int avg, sum=0;

  int marks[30];

  int i;

  for(i=0; i<=29; i++){

  printf(“enter the marks”);

  scanf(“%d”, &marks[i]);

}

  for(i=0; i<=29; i++){

  sum=sum+marks[i];

}

  avg=sum/30;

  printf(“avg is %d/n”, avg);

}