#include "stdafx.h" #include using namespace std; #define NUM_YEARS 10 #define NUM_STATES 50 int main() { int SoyProd[NUM_YEARS][NUM_STATES]; int totalYearlyProd[NUM_YEARS]; int totalStateProd[NUM_STATES]; // calculate soy prod per year across all states for (int y = 0 y < NUM_YEARS; y++) { totalYearlyProd[y] = 0; for (int s = 0; s < NUM_STATES; s++) totalYearlyProd[y] += SoyProd[y][s]; } for (int s = 0; s < NUM_STATES; s++) { totalStateProd[s] = 0; for (int y = 0; y < NUM_YEARS; y++) totalStateProd[s] += SoyProd[y][s]; } int totalProd = 0; for (int y = 0; y < NUM_YEARS; y++) totalProd += totalYearlyProd[y]; return 0; }