Hi there guys, im new to the forum.
Currently a first year programming student, and struggling on arrays as i missed a lecture. Here's what i need to do, and what ive done, before i hit my point of not knowing any more.
Im trying to write a program that will read this data into a 2 dimensional array (data is 1,2,3,4,5,6,7,8,9) so, i've used this
Code:
int arr[3][3]={
{1,2,3},
{4,5,6},
{7,8,9}
};
then ive used
Code:
int i,j;
for (i=0;i<3;++i)
{
for(j=0;j<3;++j)
printf("%d",arr[i][j]);
printf("\n");
}
to make the program produce the data into a nicely formatted array
1 2 3
4 5 6
7 8 9
Which so far is correct, and working.
Now i need to have the add the value's within the columns, and have them output a lower total, and a side total. What i mean is,
Code:
1 2 3| 6
4 5 6| 15
7 8 9| 24
==========
12 15 18
Im stumped as to how i do this, and my text book only tells me so much, please, i hope you can help me!
MANY THANKS,
Masschino