Advertisement
Guest User

yolo

a guest
Feb 12th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.54 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. int main() {
  6.    
  7.     int ntot, nestr, esito, nrip;
  8.    
  9.    
  10.     printf("Numero Massimo: ");
  11.     scanf("%d", &ntot);
  12.    
  13.     printf("Numero Estrazioni: ");
  14.     scanf("%d", &nestr);
  15.    
  16.     srand(time(NULL)); // randomizza sfuttando i secondi che passano, quindi si ha sempre un numero diverso
  17.     for (nrip=1; nrip<=nestr; nrip++) { // esegue un totale di nrip ripetizioni
  18.         esito=1+rand()%ntot; // i valori random saranno compresi tra 1 e ntot
  19.         printf("%d\n",esito);
  20.     }
  21.    
  22.    
  23.     system("pause");
  24.     return 0;
  25.    
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement