解题思路:
注意事项:注意for循环的控制条件
参考代码:
#include<stdio.h> struct Date { int year; int mouth; int day; } student1; int main() { int i,a[12]={31,28,31,30,31,30,31,31,30,31,30,31}; int sum=0; scanf("%d%d%d",&student1.year,&student1.mouth,&student1.day); sum=sum+student1.day; for(i=0;i<student1.mouth-1;i++) sum+=a[i]; if(student1.year%400==0||(student1.year%4==0&&student1.year%100!=0)) printf("%d",sum+1); else printf("%d",sum); }
0.0分
0 人评分