Coder's Guild Mailing List

Re: about c

Posted by Eian on 1999-07-05

> yes it is that please send me a demo programme if you can where it prints a 
> randomized numbers

Ok, here is a program that prints out 10 random numbers, from 0-100:

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

void main()
{
  srand((unsigned) time(NULL); /*this line seeds the random number*/
                               /*generator with the current time  */

  for(int i=0;i < 10;i++)
    printf("%d\n",(rand() % 101));
}