-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathR23-10-31C-Lang-Test.c
53 lines (52 loc) · 1.17 KB
/
R23-10-31C-Lang-Test.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>
int main(void) {
int tyesr;
int today;
int day;
int month;
int year;
printf("input the this year: ");
scanf(tyear);
printf("input the today: ");
scanf(today);
printf("input the day: ");
scanf(day);
printf("input the month: ");
scanf(month);
printf("input the year: ");
scanf(year);
if (day < today) {
printf("%d your tosi: ", tyear - year);
} else {
printf("%d your tosi: "), tyear - year -1;
}
}
思ったよりミス↑がありました。修正後はこちら↓。
*/
#include<stdio.h>
int main(void) {
int Tyear, Tmonth, Tday, Bday, Bmonth, Byear;
printf("input the this year: ");
scanf("%d", &Tyear);
printf("input the current month: ");
scanf("%d", &Tmonth);
printf("input the today: ");
scanf("%d", &Tday);
printf("input the day: ");
scanf("%d", &Bday);
printf("input the month: ");
scanf("%d", &Bmonth);
printf("input the year: ");
scanf("%d", &Byear);
if (Tmonth > Bmonth) {
if (Bday < Tday) {
printf("%dyour tosi: ", Tyear - Byear);
} else {
printf("%dyour tosi: ", Tyear - Byear - 1);
}
} else {
printf("%dyour tosi: ", Tyear - Byear - 1);
}
return 0;
}