-
Notifications
You must be signed in to change notification settings - Fork 0
/
Captcha_by_Math.c
53 lines (47 loc) · 1.08 KB
/
Captcha_by_Math.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
52
53
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main() {
int num1, num2, ans, op, input;
srand(time(NULL));
num1 = (rand()%50)+1;
num2 = (rand()%50)+1;
op = rand()%3;
switch(op) {
case 0:
ans = num1+num2;
printf("%d + %d = ", num1, num2);
scanf("%d", &input);
if(ans==input) {
printf("\tYou're Right. \n\n");
}
else {
printf("\tSorry, It's Wrong. \n\n");
}
break;
case 1:
ans = num1-num2;
printf("%d - %d = ", num1, num2);
scanf("%d", &input);
if(ans==input) {
printf("\tYou're Right. \n\n");
}
else {
printf("\tSorry, It's Wrong. \n\n");
}
break;
case 2:
ans = num1*num2;
printf("%d * %d = ", num1, num2);
scanf("%d", &input);
if(ans==input) {
printf("\tYou're Right. \n\n");
}
else {
printf("\tSorry, It's Wrong. \n\n");
}
break;
}
main();
return 0;
}