for循环,百钱买百鸡

public class selfAddMinus{

public static void main(String[] args){

int x,y,z;

for(x=0;x<=100;x++){

for(y=0;y<=100;y++){

for(z=0;z<=300;z+=3){

if(x+y+z ==100 && 5*x+3*y+z/3 ==100){

System.out.println(“gongji:”+x+”;muji:”+y+”;xiaoji:”+z+”;”);

}
}
}
}
 }
}

发表评论