Write a C program to calculate the total and average of marks

void main( )
{
      int avg, sum = 0;
      int marks[10];
      for (int i = 0; i<=9; i++ )
      {
            printf ( “\n Please enter marks for 10 students: ” );
            scanf ( “%d”, &marks[i] );
      }
     for (i = 0; i<=9; i++)
          sum = sum + marks[i];
     avg = sum / 20;
     printf ( “\n Total marks secured by 10 students in a test are %d”, sum);
     printf ( “\n Average marks secured by 10 students in a test are %d”, avg);

}

No comments:

Post a Comment