求第4、5小题的答案和过程!
2个回答
展开全部
main()
{
int year, month, day, i, days[11], which_day;
days = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30};
scanf("%d %d %d", &year, &month, &day);
which_day = 0;
for(i = 0; i < month - 1; i++) {
which_day += days[i];
}
if((year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)) & month > 2) {
which_day++;
}
which_day += day;
printf ("the answer is %d\n", which_day);
}
main() {
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
if( a < 0 || b < 0 || c < 0 ) exit();
if( a + b > c || a+c > b || b + c > a) exit();
if( a == b) {
if (a == c) printf("a=b=c\n");
else printf ("a = b\n");
} else {
if (a == c || b == c) printf ("...\n");
else printf("...\n");
}
}
{
int year, month, day, i, days[11], which_day;
days = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30};
scanf("%d %d %d", &year, &month, &day);
which_day = 0;
for(i = 0; i < month - 1; i++) {
which_day += days[i];
}
if((year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)) & month > 2) {
which_day++;
}
which_day += day;
printf ("the answer is %d\n", which_day);
}
main() {
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
if( a < 0 || b < 0 || c < 0 ) exit();
if( a + b > c || a+c > b || b + c > a) exit();
if( a == b) {
if (a == c) printf("a=b=c\n");
else printf ("a = b\n");
} else {
if (a == c || b == c) printf ("...\n");
else printf("...\n");
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询