當前位置:編程學習大全網 - 編程軟體 - 編程動物案例

編程動物案例

公共類測試{

公共靜態void main(String[] args) {

int count = 30

int possible num = 1;

for(int I = 4;我& lt=計數;i += 4) {

for(int j = 4;j & lt= count-I;j += 4) {

for(int x = 2;x & lt= count-(j+I);x += 2) {

if (x + j + i == count ) {

system . out . println(" * * * * * * * * * * * *可能"+Possible num++ ":);

system . out . println(" pig = "+(I/4));

system . out . println(" dog = "+(j/4));

system . out . println(" chicken = "+(x/2));

}

for(int y = 2;y & lt= count-(x+j+I);y += 2) {

if (y + x + j + i == count ) {

system . out . println(" * * * * * * * * * * * *可能"+Possible num++ ":);

system . out . println(" pig = "+(I/4));

system . out . println(" dog = "+(j/4));

system . out . println(" chicken = "+(x/2));

system . out . println(" duck = "+(y/2));

}

}

}

}

}

}

}

  • 上一篇:c++ 編程問題之模板類和模板函數
  • 下一篇:給剛開始上學的孩子的文案短句
  • copyright 2024編程學習大全網