求解.条件何来????

07-06-25 java0000000
/* Note:Your choice is C IDE */

/*鸡免同笼问题,输入所有鸡免的头数的脚数,求鸡免个数*/

#include "stdio.h"

main()

{

int f,h,c,r;

scanf("%d,%d",&f,&h);

if(f%2==0&&f>0&&f>2*h&&f<4*f)

{

r=(h-2*f)/2;

c=f-(h-2*f)/2;

printf("免为=%d",r);

printf("鸡为=%d",c);

}

else

{

printf("输入的数字不对");

}

}

猜你喜欢