解题思路:
注意事项:
参考代码:
#include <stdio.h>
int main()
{
struct years
{
;
int year;
int mouth;
int day;
}years1;
int a[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 },sum=0;
scanf("%d %d %d", &years1.year, &years1.mouth, &years1.day);
if (years1.year % 4 == 0 && years1.year % 100 != 0 || years1.year % 400 == 0)
{
a[1] = 29;
}
sum += years1.day;
for (int i = 1,j=0; i < years1.mouth; i++)
{
sum += a[j];
j++;
}
printf("%d", sum);
return 0;
}
0.0分
3 人评分
简单的a+b (C语言代码)浏览:765 |
C二级辅导-阶乘数列 (C语言代码)浏览:642 |
C语言程序设计教程(第三版)课后习题8.6 (C语言代码)浏览:609 |
简单的a+b (C语言代码)浏览:676 |
C语言程序设计教程(第三版)课后习题8.9 (C语言代码)浏览:690 |
C二级辅导-统计字符 (C语言代码)浏览:528 |
矩阵乘法 (C++代码)浏览:1662 |
C语言程序设计教程(第三版)课后习题8.3 (C语言代码)浏览:693 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:583 |
兰顿蚂蚁 (C++代码)浏览:1160 |