#include <stdlib.h> #include <stdio.h> #include <time.h>void main( void ) { int i; /* Seed the random-number generator with current time so that * the numbers will be different every time we run. */ srand( (unsigned)time( NULL ) ); /* Display 10 numbers. */ for( i = 0; i < 10;i++ ) //u can change the value of i printf( " %6d\n", rand()%1000 ); }
#include <stdio.h>
#include <time.h>void main( void )
{
int i; /* Seed the random-number generator with current time so that
* the numbers will be different every time we run.
*/
srand( (unsigned)time( NULL ) ); /* Display 10 numbers. */
for( i = 0; i < 10;i++ ) //u can change the value of i
printf( " %6d\n", rand()%1000 );
}