Guest User

Untitled

a guest
Feb 21st, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.31 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <time.h>
  3. #include <stdlib.h>
  4.  
  5.  
  6. int main(void)
  7. {
  8.     // seed with random time
  9.     srand(time(NULL));
  10.  
  11.     // andom number 1 - 6
  12.     int rand_num = rand() % 6 + 1;
  13.  
  14.     // print number to screen
  15.     printf("random number = %d\r\n", rand_num);
  16.  
  17.     // pause before exit
  18.     getchar();
  19.     return 0;
  20. }
Add Comment
Please, Sign In to add comment