Need help working with an array
Hi all, I'm having trouble working with an array, and I was wondering if anyone could explain it to me. What I want to do is have a 5x5 array, entered one row at a time, that will add each row and each column.
For example:
Enter row 1: 1 2 3 4 5
Enter row 2: 6 7 8 9 0
Row totals: 15 30
Column totals: 7 9 11 13 5
And so on. I'll post the code I have, but it's pretty basic stuff since I don't know where to go with it. Any help would be greatly appreciated.
Code:
#include <stdio.h>
#include <stdlib.h>
#define N 5
int main()
{
int a[N][N], i, rowSum, colSum;
printf("Enter %d numbers: ", N);
for (i = 0; i < N; i++)
scanf("%d", &a[i]);
return 0;
}