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

編程案例動物

公共類測試{

公共靜態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));

}

}

}

}

}

}

}

  • 上一篇:從鍵盤輸入四個學生的名字和三門課的成績,得到平均分,將平均分從小到大排序後輸出程序。
  • 下一篇:usb遊戲手柄如何用JoyToKey設置映射鍵盤?
  • copyright 2024編程學習大全網