Advertisement
link186fr

Numeros Random

Dec 29th, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.62 KB | None | 0 0
  1.     #include <stdio.h>    
  2.     #include <stdlib.h>  
  3.     #include <time.h>    
  4.  
  5.      main( )  
  6.     {  
  7.          unsigned long num[1];
  8.          unsigned long cantidad,contador;  
  9.          unsigned long hora = time(NULL);  
  10.        
  11.          srand(hora);  
  12.      
  13.             printf("Ingrese la cantidad de numeros aleatorios que desea generar\n");  
  14.             scanf("%lu",&cantidad);  
  15.      
  16.             for(contador = 0; contador<cantidad; contador++)  
  17.             {  
  18.      
  19.                    num[cantidad] = rand()%(2);  
  20.                    printf("%lu\n", num[cantidad]);  
  21.             }  
  22.      
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement