Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.56 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. int main(void)
  6. {
  7. int input;
  8. scanf("%d", &input);
  9. int i;
  10. int roll;
  11. time_t t;
  12. int sum = 0;
  13.  
  14. srand((unsigned) time(&t));                                 // the seed for    the random number generator based on the current time
  15.  
  16.  
  17. for( i = 0; i < input; i++)
  18. {
  19. roll = (rand() % 11 + 1);                                    // random number generator
  20.   sum += roll;                                              
  21. printf("You Rolled : %d\n", roll);
  22. }
  23.  
  24.     printf("The Total Turn Score is : %d", sum);
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement