public class world {
public static void main(String[] args) {
int men;
int women;
int kids;
for (men=0;men<=30;men++) {
for (women=0;women<=30;women++) {
for (kids=0;kids<=30;kids++) {
if (men+women+kids==30) {
if (3*men+2*women+1*kids==50) {
System.out.println("男人:" +men+"女人:" +women+"小孩:" + kids);
}
}
}
}
}
}
}
第六章for循环结构
最新推荐文章于 2022-01-15 14:30:13 发布