-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrussian.c
51 lines (30 loc) · 1.06 KB
/
russian.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void russian(void);
void russian(void) {
srand(time(NULL));
int number = rand() % 10 + 1;
int response;
int attempts = 3;
for (int num = 0; num < attempts; num++) {
printf("Attempt number : %d out of %d\n", num + 1, attempts);
printf("Please enter a number generated by the roulette wheel ! : ");
scanf("%d", &response);
if (response < 1 || response > 10) {
printf("This option is invalid, please choose a number between 1 and 10 !\n");
}
else if (response == number) {
printf("You have found the number generated by the roulette wheel ! : %d\n", number);
return;
}
else {
printf("You did not manage to find the number generated by the roulette wheel !\n");
}
}
printf("The number was : %d\n", number);
}
int main() {
russian();
return 0;
}