Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- int main() {
- int ntot, nestr, esito, nrip;
- printf("Numero Massimo: ");
- scanf("%d", &ntot);
- printf("Numero Estrazioni: ");
- scanf("%d", &nestr);
- srand(time(NULL)); // randomizza sfuttando i secondi che passano, quindi si ha sempre un numero diverso
- for (nrip=1; nrip<=nestr; nrip++) { // esegue un totale di nrip ripetizioni
- esito=1+rand()%ntot; // i valori random saranno compresi tra 1 e ntot
- printf("%d\n",esito);
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement