Advertisement
hmcristovao

Lista 03 - exerc 34

Jun 18th, 2013
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <time.h>
  3. #define QTDE_NUMEROS 15
  4. int main() {
  5.     int i, sorteado, freq[6]={0};
  6.     srand(time(NULL));
  7.     for(i=1; i<=QTDE_NUMEROS; i++) {
  8.         sorteado = (rand() % 6) + 1;
  9.         printf("%d ", sorteado);
  10.  
  11.         freq[sorteado-1]++;
  12.     }
  13.     printf("\nDistribuicao de frequencia dos numeros sorteados");
  14.     for(i=0; i<6; i++)
  15.         printf("\nQtde de vezes do numero %d: %d",i+1,freq[i]);
  16.  
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement