package org.westos.www;
/*
1.给定一个年份,判断是否是闰年。
A:能被4整除,并且不能被100整除
或者
B:能被400整除。
*/
import java.util.Scanner;
public class Runnian
{
public static void main(String[] args)
{
Scanner scan=new Scanner(System.in);
System.out.println("请输入年份:");
int x=scan.nextInt();
if(x%4==0&&x%100!=0)
{
System.out.println("今年是闰年");
}
else if(x%400==0)
{
System.out.println("今年是闰年");
}
}
}
package org.westos.www;
public class chicken
{
public static void main(String[] args)
{
for(int x=1;x<100;x++)
{
for(int y=1;y<100-x;y++)
{
int z=100-x-y;
if(5*x+3*y+1/3*z==100 && x+y+z==100)
{
System.out.println("小鸡 =" + x);
System.out.println("母鸡 =" + y);
System.out.println("公鸡 =" + z);
System.out.println();
}
}
}
}
}
package org.westos.www;
public class twoadd
{
public static void main(String[] args)
{ /*
int i=0,sum=0;
int count=0;
while(count<5)
{
count++;
i=i*10+2;
sum+=i;
}
System.out.println("sum="+sum);
*/
int i=0,sum=0;
for(int n=1;n<=5;n++)
{
i=i*10+2;
sum+=i;
}
System.out.println("sum="+sum);
}
}