I am a newbie trying create an array that will sum the row and columns. I have been able to get them to display,but not total. Any help would be great.
Code:
#include <stdio.h>
void main(void)
{
int val[5][5] = {8,3,9,0,10,
3,5,17,1,1,
2,8,6,23,1,
15,7,3,2,9,
6,14,2,6,0};
void display (int nums[5][5]); /* function prototype */
display(val);
}
void display(int nums[5][5])
{
int row_num, col_num;
for (row_num = 0; row_num <5; ++row_num)
{
for(col_num = 0; col_num <5; ++col_num)
printf("%5d",nums[row_num][col_num]);
printf("\n");
}
}