Tuesday, November 17, 2009

A simple program for random number generation

Random Number Generation

Write a C / C++ Program to generate random numbers

SOURCE CODE

#include

#include

#include

#include

void main()

{

int n,i,r;

clrscr();

randomize();

printf("Enter the number of random numbers required: " );

scanf("%d",&n);

printf("The limit of random nos: ");

scanf("%d",&r);

for(i=0;i

{

printf("\nRandom no. between 0-%d:

%d",r,random(r));

}

getch();

}

No comments:

Post a Comment