chapter5
This commit is contained in:
14
DeitelC/Chapter5/randExample.c
Normal file
14
DeitelC/Chapter5/randExample.c
Normal file
@ -0,0 +1,14 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main (void) {
|
||||
printf("%d\n", 1 + rand() % 6);
|
||||
printf("%d\n", 100 + rand() % 900);
|
||||
printf("%d\n", rand() % 19);
|
||||
printf("%d\n", 1000 + rand() % 1222);
|
||||
printf("%d\n", -1 + rand() % 2);
|
||||
printf("%d\n", -3 + rand() % 15);
|
||||
printf("%d\n", 3 * (1 + rand() % 10));
|
||||
printf("%d\n", 3 + 2 * (rand() % 9));
|
||||
printf("%d\n", 3 + 5 * (rand() % 7));
|
||||
}
|
Reference in New Issue
Block a user