#include<stdio.h>
struct tian
{
int year;
int month;
int day;
};
int days(int year,int month,int day)
int s=0,i,a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
if(year%4==0&&year%100!=0||year%400==0)
a[2]=29;
for(i=1;i<month;i++)
s+=a[i];
s=s+day;
return s;
}
void main()
int k=0;
struct tian a;
printf("輸入年月日:");
scanf("%d%d%d",&a.year,&a.month,&a.day);
k=days(a.year,a.month,a.day);
printf("%d年%d月%d日是第%d天\n",a.year,a.month,a.day,k);
#include<stdio.h>
struct tian
{
int year;
int month;
int day;
};
int days(int year,int month,int day)
{
int s=0,i,a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
if(year%4==0&&year%100!=0||year%400==0)
a[2]=29;
for(i=1;i<month;i++)
s+=a[i];
s=s+day;
return s;
}
void main()
{
int k=0;
struct tian a;
printf("輸入年月日:");
scanf("%d%d%d",&a.year,&a.month,&a.day);
k=days(a.year,a.month,a.day);
printf("%d年%d月%d日是第%d天\n",a.year,a.month,a.day,k);
}