All pastes #994348 Raw Edit

Something

public text v1 · immutable
#994348 ·published 2008-04-23 10:31 UTC
rendered paste body
#include <stdio.h>
#include<time.h>
#define N_MAX 20
#define M_MAX 20

main() {

  int m, n, i, j, max, polje[20][20], stupci[20], suma=0;
  srand(time(NULL));
  
  do {
		printf("\nUnesite broj redaka matrica: ");
		scanf("%d", &m);
		printf("Unesite broj stupaca matrica: ");
		scanf("%d", &n);
	} while ( !( m >1 && n <=M_MAX && n >1 && n <=N_MAX ) );

  printf("Dimenzije matrice su %dx%d\n\n", m, n);
  
  printf("\nIspis elemenata matrice :\n");
	for (i = 0; i < m; i++) {
		for (j = 0; j < n; j++) {
          polje[i][j]=rand()%150+1;
		  printf("%5d", polje[i][j]); }
		  { 
          printf("\n"); 
          }}
          
 //Zbroj elemenata kolone.
    for (j = 0; j < n; j++) 
  { 
     stupci[j] = 0; 
     for (i = 0; i < m; i++) 
        stupci[j] += polje[i][j];  {
                   
        printf( "%5d", stupci[j] );      
        }}

//Najveći zbroj
    if (j == 0) {
      max = stupci[j];
    }
    if (max < stupci[j]) {
      max = stupci[j];} {
      printf("\nNajveci element polja je %d\n\n", max);
    
}
  
  getche();
  return 0;
}