Solution for Exercise 11-19
ex1119
#include <stdio.h>
#include <stdlib.h>
int main()
{
unsigned seed;
int r,a,b;
printf("Input a random number seed: ");
scanf("%u",&seed);
srand(seed);
for(a=0;a<20;a++)
{
for(b=0;b<5;b++)
{
r=rand();
printf("%d\t",r);
}
putchar('\n');
}
return(0);
}
Notes
* The %u in the scanf() function ensures that only positive integer values are input.
Copyright © 1997-2025 by QPBC.
All rights reserved
