Well from the first page it seems everyone is at that part of the semester with arrays...lol My question is, I understand how the input works, but now I have to understand how the ouput works?
This program asks for a 5 X 5 array. Then prints out the sum for each of the rows, and then the columns.
EX:
Row totals: 12 5 15 12 23
Column totals: 30 34 45 23 12
You guys get the idea..
I think I would just need to use more for statements, becasue this code gives me the sum of all the numbers. However I am confused where?Code:#include<stdio.h> main () { int a[5][5]; int sum=0, row=0, col=0, x=0, n=0; for ( row = 0; row < 5; row++ ) { printf("Enter row %d (5 digits): ", row+1); for ( col = 0; col < 5; col++ ) { scanf("%d", &a[row][col]); sum += a[row][col]; } } printf("Row totals: %d \n", sum ); return 0; }
CJ