http://bbs.freekaoyan.com/viewthread.php?tid=193444
用scanf函数输入一个年份year,然后用一个赋值语句计算这一年中2月份的天数datesum,最后用格式输出函数printf输出datesum值。
具体要求如下:
(1)所有变量为整型。
(2)输入前要有提示。
(3)输出结果时要有必要的文字说明。
---------------------------------
#include<stdio.h>
void main()
{
int a,b;
printf("Please input year!\n");
scanf("%d",&a);
if(a%4==0)
{
if(a0!=0){
b=29;
printf("The number of days of February:datasum=%d\n",b);
}
else{
if(a@0==0){
b=29;
printf("The number of days of February:datasum=%d\n",b);
}
else{
b=28;
printf("The number of days of February:datasum=%d\n",b);
}
}
}
else
{
b=28;
printf("The number of days of February:datasum=%d\n",b);
}
}
应该就是这样写的
---------------------------------
若你用的是VC 6.0工具,可用中文写提示!
