This is an assignment given to me with the worst possible book for this class. Basically, i need this code to add the row and col of the user input. i know it is missing the row portion, but currently, the col addition is summing everything together twice and i dont see why. The teacher wont help me because the class is a "self taught" class, however, i need this to pass the class.
// test 2.cpp : Defines the entry point for the console application.
//
#include <stdio.h>
#include "stdafx.h"
int
main(void)
{
int array[4][4]={0};
int i, j;
int sum;
printf (
"Please enter the numbers you wish to be added (with a space between each number)\n");
printf (
"when all numbers are entered, press enter to \n calculate each row and columns totals\n");
for
(i = 0; i < 3; ++i)
for
(j = 0; j < 3; ++j)
scanf_s("%d", &(array[i][j]));
for
(i = 0; i < 4; ++i){
for (j = 0; j < 3; ++j)
{array[3][j]+= array[i][j];
printf("%d\t",array[i][j]); }
printf("\n");}
return 0;
}