// zd1.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "stdio.h" #include "stdlib.h" #include "time.h" int _tmain(int argc, _TCHAR* argv[]) { int tab[5][6]; int sum = 0; int max = 0; srand((unsigned) time(NULL)); for(int k = 0; k < 6; ++k) { int s = 0; for(int w = 0; w < 5; ++w) { rand(); tab[w][k] = 1 + rand() % 1000; printf("%i ", tab[w][k]); s = s + tab[w][k]; } if(s > sum) { sum = s; max = k; } printf("\n"); } printf("\nNumer kolumny o najwiekszej wartosci: %i (suma = %i)\n", max, sum); system("pause"); }