All pastes #996118 Raw Edit

Unnamed

public text v1 · immutable
#996118 ·published 2008-04-24 18:55 UTC
rendered paste body
#include <stdio.h>
#include <time.h>

#define TOP 10
#define DOWN 1
#define MAX 30

int main()
{
   int N[MAX];
   int C[TOP] = {0};
   int x, i, max = 0;
   
   printf("Koliko brojeva?");
   scanf("%d", &x);
   srand((time) NULL);
   for (i = 0; i < x; i++) {
      N[i] = rand() % TOP + DOWN;
      C[N[i]-1]++;
      printf("%d ", N[i]);
   }
   for (i = 0; i < TOP; i++) {
      if (C[max] < C[i])
         max = i;
   }
   max++;
   printf("\nNajvise se ponavlja broj: %d (%d puta)\n", max, C[max-1]);
   getche();
   return 0;
}