Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
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
c4
example of scanf and basic integer manipulation
CS HW2
Leap year check
GCC supports 128-bit integer arithmetic
1/30
test1.c
factorial using function in c
faster posting list using skip pointers
coding!!Woo!!