PSEUDO RANDOM NUMBER GENERATOR - C-Tutorial

Latest

Monday, 26 September 2016

PSEUDO RANDOM NUMBER GENERATOR

/* PSEUDO RANDOM NUMBER GENERATOR */


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

main()
{
int i,n;
clrscr();
printf("\n Enter n value: ");
scanf("%d",&n);
srand(time(NULL));
for(i=1;i<=n;i++)
{
printf("rand(%d)=%d \n",i,rand());
}
getch();
}

No comments:

Post a Comment