哥哥 这是编程~~
追答甚麼语言 ? 这个是用 perl 写的, 给你参巧一下
# Let X be numbers of rabbits
# Let Y be numbers of chickens
$found = 0 ;
for $x ( 1..25 ) {
for $y ( 1..25 ) {
if ( $x * 4 + $y * 2 == 80) {
print "We found there are $x rabbits and $y chickens!";
$found = 1;
last;
}
}
last if $found
}
编程啊
追答int x,y;
int i;
int j ;
for(x = 1; x < 25 ; x++){
for(y = 1;y < 20 ; y++){
i=x + y;
j = 2*x + 4*y
if(i==25 && j==80)
print( i, j);
else {
i = 0;
j = 0;
}
}
}