Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int diceroll_1;
- diceroll_1=(rand()%3)+1;
- printf("%dn",diceroll_1);
- #include <time.h>
- #include <stdio.h>
- #include <stdlib.h>
- int main(void)
- {
- srand(time(NULL)); // only once
- // roll the dice
- int diceroll_1;
- diceroll_1=(rand()%3)+1;
- printf("%dn",diceroll_1);
- return 0;
- }
- Georgioss-MacBook-Pro:~ gsamaras$ gcc -Wall main.c
- Georgioss-MacBook-Pro:~ gsamaras$ ./a.out
- 3
- Georgioss-MacBook-Pro:~ gsamaras$ ./a.out
- 1
Add Comment
Please, Sign In to add comment