rand in c return type

Solutions on MaxInterview for rand in c return type by the best coders in the world

showing results for - "rand in c return type"
Thiago
08 Jul 2018
1#include <stdio.h>
2#include <stdlib.h>
3
4int main () {
5   int i, n;
6   time_t t;
7   
8   n = 5;
9   
10   /* Intializes random number generator */
11   //srand((unsigned) time(&t));
12
13   /* Print 5 random numbers from 0 to 49 */
14   for( i = 0 ; i < n ; i++ ) {
15      printf("%d\n", rand() % 50);
16   }
17   
18   return(0);
19}