1.
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<ctype.h>
#include<string.h>
int main() {
int i;
int diceRoll;
for( i = 0; i<20; i++){
printf("%d \n", rand());
}
return 0;
}
2.
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<ctype.h>
#include<string.h>
int main() {
int i;
int diceRoll;
for( i = 0; i<20; i++){
diceRoll = (rand()%6) +1; (divide the number by 6 and gives the remainder and add 1 to it)
printf("%d \n", diceRoll);
}
return 0;
}
3.
I want to give you a challenge where I want you to create a game where
the user rolls three dice and it prints out their total to them on dice a plus b plus dice c so after it gets the sum the user is going to look at it and it's going to guess if the next roll is to be higher and if it is they'll just type in H and press Enter lower in the press L or the same they'll press s and hit enter and then they're going to roll the dice again and if they got it right if they guess correctly we'll just like print out good job if they got it wrong print out you suck
that's it
Comments
Post a Comment