1 package bbb; 2 3 public class Chicken { 4 5 public static void main(String[] args) { 6 int x,y,z; 7 for(x=0;x<=14;x++) 8 for(y=0;y<=25;y++) 9 { 10 z=100-x-y; 11 if(x+y+z==100&&5*x+3*y+z/3.0==100) 12 System.out.println("公鸡"+x+"只,"+"母鸡"+y+"只,"+"小鸡"+z+"只"); 13 } 14 15 } 16 17 }
1 package bbb; 2 public class Chongfu { 3 4 public static void main(String[] args) 5 { 6 int i,j,k,t=0,m=0; 7 for(i=1;i<=4;i++) 8 for(j=1;j<=4;j++) 9 if(i!=j) 10 for(k=1;k<=4;k++) 11 if(k!=i&&k!=j) 12 13 { m++; 14 System.out.print(i*100+j*10+k+" "); 15 if(m%8==0) 16 System.out.println(); 17 t++; 18 19 } 20 System.out.println("不重复的数一共有"+t+"个"); 21 } 22 }
1 package bbb; 2 import java.util.Scanner; 3 public class Shusu { 4 5 public static void main(String[] args) { 6 int x,i; 7 Scanner in =new Scanner(System.in); 8 x=in.nextInt(); 9 for(i=2;i<x;i++) 10 if(x%2==0) 11 { 12 System.out.println(x+"不是素数"); 13 break; 14 } 15 if(i>=x) System.out.println(x+"不是素数"); 16 17 } 18 19 }