hi i really need help i try many thing and i cant get an average for a column can someone help me i need to hand this in today. thank you
Sorry is column that i want not row
Code:
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int main()
{
char student[50][25];
int marks[50][5];
int rowtotal,rowavg;
int i, j,x;
int num = 0;
printf("how many studen");
scanf("%i",&x);
if(x<=50)
{
for (i = 0; i < x; i++)
{
printf("name => ");
fflush(stdin);
gets(student[i]);
printf("marks for prg=>");
scanf("%d", &marks[i][0]);
printf("marks for DGS=>");
scanf("%d", &marks[i][1]);
printf("marks for MTH=>");
scanf("%d", &marks[i][2]);
printf("marks for ECR=>");
scanf("%d", &marks[i][3]);
printf("marks for GED=>");
scanf("%d", &marks[i][4]);
}
}
printf("\nStudent\tPRG\tDGS\tMTH\tECR\tGED\n");
for (i = 0; i < x; i++) {
printf("%s", student[i]);
printf("\t%d\t%d\t%d\t%d\t%d", marks[i][0],marks[i][1],marks[i][2],marks[i][3],marks[i][4]);
printf("\n");
}
rowtotal+=marks[1][i];
rowavg=rowtotal/x;
printf("%i",rowavg);
getch();
}