interval.c (440B)
1 /* Esercizio 5.13 */ 2 3 #include <stdio.h> 4 #include <stdlib.h> 5 #include <time.h> 6 7 int main() 8 { 9 srand(time(NULL)); 10 11 printf("1 <= %d <= 2\n", 1 + rand() % 2); 12 printf("1 <= %d <= 100\n", 1 + rand() % 100); 13 printf("0 <= %d <= 9\n", rand() % 10); 14 printf("1000 <= %d <= 1112\n", 1000 + 1 + rand() % 112); 15 printf("-1 <= %d <= 3\n", -1 + rand() % 5); 16 printf("-3 <= %d <= 11\n", -3 + rand() % 15); 17 18 return 0; 19 } /* E0F main */ 20