#10899: 系統顯示輸出短少,該如何修改


apple68040 (傑)


#include<iostream>
using namespace std;
int main()
{
int n=0,a,b,c;
cin>>n;
a=n%4;
b=n%100;
c=n%400;
if(a==0,b!=0)
cout<<"閏年";
else if(c==0)
cout<<"閏年";
else
cout<<"平年";
return 0;
}

#10968: Re:系統顯示輸出短少,該如何修改


hangofgod (CodeTurtle)


#include
using namespace std;
int main()
{
int n=0,a,b,c;
cin>>n;
a=n%4;
b=n%100;
c=n%400;
if(a==0,b!=0)
cout<<"閏年";
else if(c==0)
cout<<"閏年";
else
cout<<"平年";
return 0;
}



Input 不只一個, 要LOOP

#10985: Re:系統顯示輸出短少,該如何修改


sabina (流雲)


#include
using namespace std;
int main()
{
int n=0,a,b,c;
cin>>n;
a=n%4;
b=n%100;
c=n%400;
if(a==0,b!=0)
cout<<"閏年";
else if(c==0)
cout<<"閏年";
else
cout<<"平年";
return 0;
}

#include <stdio.h>
int main(void)
{
int a,b;
while(scanf("%d",&a)!=EOF)
{
if (a%400==0 || a%100!=0 && a%4==0)
printf("閏年\n");
else
printf("平年\n");
}
}
 
 
其實這個方法也可用
比較短