第八章 3

package a8;


public class A3 {
public static void main(String[] args) {
int gj,mj,xj;
int gjPrice = 5;
int mjPrice = 3;
double xjPrice = 1/3;
for(gj = 0;gj <= 20;gj++) {
for(mj = 0,xj = 100-gj-mj;mj <= 33;mj++,xj--) {
if(gj*gjPrice+mj*mjPrice+xj*xjPrice == 100) {
System.out.println("公鸡有:"+gj+"  "+"母鸡有:"+mj+"  "+"小鸡有:"+xj);
}
}
}
}
}

猜你喜欢

转载自blog.csdn.net/lsxdbd/article/details/79853717