題目:公雞5元一只,母雞3玩一只,小雞1元三只,問一百元正好用完能買一百只雞,求能買公雞,母雞,小雞各多少只?
class Ex1
{
public static void main(String args[])
{
int a,b;
for (a=0;a<101;a++){
for(b=0;b<101;b++){
if (7*a+4*b==100){
System.out.println(a+"\t"+b+"\t"+(100-a-b)); }
}
}
}
}
class Ex1
{
public static void main(String args[])
{
int a,b;
for (a=0;a<101;a++){
for(b=0;b<101;b++){
if (7*a+4*b==100){
System.out.println(a+"\t"+b+"\t"+(100-a-b)); }
}
}
}
}