Answer to Question #43912 in C for anandumi

Question #43912
Please help me the following question:- Write a program takes n student’s score with eight subjects each from user (where, n is specified by user), stores data in an array and calculates the total and average of each student score. The printout of array should be in tabular from as shown below: no OIT111 OIT112 OIT113 OIT114 OIT115 OIT116 OIT117 OIT119 Total Average 1 2 3 4 …. … … …. …. …. …. …. …. … …
Expert's answer

#include <stdio.h>
#include <stdlib.h>

int main()
{
// counters
int i;
int j;

// amount of students
int n;
// students marks,mark[i][8] equals average
float mark[10][9] = {};

// marks are read
printf("Enter the amount ofstudents: ");
scanf("%d", &n);
for(i = 0; i < n; i++) {
printf("Student %d marks:", i + 1);
for (j = 0; j < 8; j++) {
scanf("%f", &mark[i][j]);

mark[i][8] += mark[i][j];
}
mark[i][8] /= 8;
}

//table is outputted
printf("no OIT111 OIT112OIT113 OIT114 OIT115 OIT116 OIT117 OIT119 Total Average\n");

for(i = 0; i < n; i++) {
printf("%-3d", i + 1);
for (j = 0; j < 8; j++) {
printf("%5.2f ", mark[i][j]);
}
printf(".2f \n", mark[i][8]);
}

return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Assignment Expert
10.07.14, 15:44

Dear Anandumi,
You're welcome. We are glad to be helpful.
If you liked our service please press like-button beside answer field. Thank you!

anandumi
09.07.14, 18:23

Thank you very much for your assistance. It works.
Be blessed.

Leave a comment

Ask Your question

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS
paypal