|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- #include <stdio.h>
- int main()
- {
- int a,b,c,d,f,g;
- printf("please input one year: ");
- a=4;
- b=100;
- g=400;
- scanf("%d",&c);
- d=c%b;
- if(d!=0)
- {
-
- f=c%a;
- if(f==0)
- {
- printf("%d is Leap year!",c);
- }
- else
- {
- printf("%d not is Leap year!",c);
- }
- }
- else d==0;
- {
- f=c%g;
- if(f==0)
- {
- printf("%d is Leap year!",c);
- }
- else
- {
- printf("%d not is Leap year!",c);
- }
- }
- }
复制代码
本帖最后由 无符号整形 于 2018-8-5 16:22 编辑
- #include <stdio.h>
- int main()
- {
- int a,b,c,d,f,g;
- printf("please input a year: ");
- a=4;
- b=100;
- g=400;
- scanf("%d",&c);
- d=c%b;
- if(d!=0)
- {
-
- f=c%a;
- if(f==0)
- {
- printf("%d is Leap year!",c);
- }
- else
- {
- printf("%d not is Leap year!",c);
- }
- }
- else //d==0;else没有条件
- {
- f=c%g;
- if(f==0)
- {
- printf("%d is Leap year!",c);
- }
- else
- {
- printf("%d is not Leap year!",c);
- }
- }
- }
复制代码
|
|