Run Code
|
Code Wall
|
Users
|
Misc
|
Feedback
|
About
|
Login
|
Theme
|
Privacy
Random test
//gcc 5.4.0 #include <stdio.h> #include <stdlib.h> //Enables use of randoms int main(void) { int myRand; printf("Four rolls of a dice...\n"); // rand() % 6 yields 0, 1, 2, 3, 4, or 5 // so + 1 makes that 1, 2, 3, 4, 5, or 6 myRand = rand(); printf("Random Number = %d\n", myRand); printf("%d\n", ((myRand % 6) + 1)); myRand = rand(); printf("Random Number = %d\n", myRand); printf("%d\n", ((myRand % 6) + 1)); myRand = rand(); printf("Random Number = %d\n", myRand); printf("%d\n", ((myRand % 6) + 1)); myRand = rand(); printf("Random Number = %d\n", myRand); printf("%d\n", ((myRand % 6) + 1)); return 0; }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Intro to Arrays with comments
Project 3 part 2 Book v0.5
Sunday assignment calculator
Linked List
Primer avance de lista enlazadas
3850
Virtual table sketch
WAP in C to delete an element from an array
part 3
ques4
Please log in to post a comment.