Hey guys,
This is actually a easy problem; I'm just having problems because i just started using it and knowing the concept of arrays. Anyways the program wants to defines a two dimensional array of size [4][4] initialized to zero; for the first row add 5 to each element and for the third row add 2 and multiple by 3, then for the second column add 2 to each element, print out the array, then find the sum of one of the diagonalize.
This what i have so far:
Code:
#include<stdio.h>
int main () {
int my[4][4];
int i,j;
for(i = 0; i < 4; i++)
my[0][i] = 5;
for(i = 0; i < 4; i++)
my [2][i] = 2;
my[2][i] = my[2][i] * 3;
for(i = 0; i < 4; i++){
for(j = 0; j < 4; j++)
printf("%d", my[i][j]);
printf("\n");
}
printf("\n\n");
return 0;
}
Any help would be appreciated, thanks.