#include
int main()
{
int year, mon, day, isLeap, i, count;
int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
printf("输入日期:(输入格式必须为yyyy-mm-dd,如2012-11-24)\n");
scanf("%d-%d-%d", &year, &mon, &day);
//判断是否为润年
if ((year % 400 == 0) || (year % 100 != 0 && year % 4 == 0) )
isLeap = 1;
else isLeap = 0;
count = 0;
month[2] = month[2] + isLeap;
for (i = 1; i < mon; i++){
count += month[i];
}
count += day;
printf("%d-%d-%d是%d年中的第%d天./n", year, mon, day,year, count);
return 0;
}
#include
int main()
{
int sum=0;
int i;
int month[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int yeal,mon,day;
printf("输入日期,格式为‘yeal,month,day’,如2012,11,23\n");
scanf("%d,%d,%d",&yeal,&mon,&day);
if((yeal%400==0)||(yeal%4==0)&&(yeal%100!=0))
month[1]=29;//若是闰年,则二月有29天。
for(i=0;i
sum=sum+day;
printf("共有%d天",sum);
return 0;
}
给定一个日期,输出这个日期是概念的第几天c语言编程题,这个你可以参考c语言编程算法