解题思路:
注意事项:
参考代码:
#include<stdio.h>
typedef struct{
int year,month,date;
}time;
int sum(int year, int month, int date)
{
int num[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int sn=0;
for(int i=0; i<month-1; i++)
{
sn += num[i];
}
sn += date;
if(year%400==0 && month>2) sn += 1;
return sn;
}
int main()
{
time days;
int day;//该年第几天
scanf("%d %d %d", &days.year, &days.month, &days.date);
day=sum(days.year,days.month,days.date);
printf("%d\n", day);
return 0;
}
0.0分
1 人评分
点我有惊喜!你懂得!浏览:1439 |
C语言程序设计教程(第三版)课后习题9.2 (C语言代码)浏览:741 |
简单的a+b (C语言代码)浏览:676 |
C语言训练-求函数值 (C语言代码)浏览:976 |
求圆的面积 (C语言代码)浏览:1366 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:1327 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:485 |
简单的a+b (C语言代码)浏览:560 |
A+B for Input-Output Practice (IV) (C语言代码)浏览:513 |
循环入门练习6 (C语言代码)浏览:1058 |