/*…… hey guy’s it is a randomizing die rolling program…*/
#include <stdlib.h>
#include<conio.h>
#include <stdio.h>
#include<conio.h>
#include <stdio.h>
/*…Main function start’s….*/
void main()
{
/*….Initialization…*/
int i;
unsigned seed;
printf( “Enter seed: ” );
scanf( “%u”, &seed );
srand( seed ); //here srand is used to randomise the seed…….
/*….Loop start’s…*/
for ( i = 1; i <= 10; i++ )
{
printf( “%10d”, 1 + ( rand() % 6 ) );
/*…Condition checking..*/
if ( i % 5 == 0 )
printf( “\n” );
void main()
{
/*….Initialization…*/
int i;
unsigned seed;
printf( “Enter seed: ” );
scanf( “%u”, &seed );
srand( seed ); //here srand is used to randomise the seed…….
/*….Loop start’s…*/
for ( i = 1; i <= 10; i++ )
{
printf( “%10d”, 1 + ( rand() % 6 ) );
/*…Condition checking..*/
if ( i % 5 == 0 )
printf( “\n” );
}
/*….Loop end’s….*/
getch();
/*….Loop end’s….*/
getch();
}
/*…Main function end’s..*/
/*…Main function end’s..*/
No comments:
Post a Comment