if(n-(int)n<0.000001)
Change your program to:
#include
{ int?i,j,m=0; double
if(n-(int)n<0.000001)
Change your program to:
#include
{ int?i,j,m=0; double?n; for(i=0;i<=20;i++) //There is a problem here, chicken The number can be 0{ n=(40-2*i)/4.0; if(n-(int)n<0.000001) //In this way, you can determine whether n is an integer{
m++ ;
printf("Chickens=%d\nRabbits=%d\n",i,int(n)); //Integer output is better} } printf("One ***There are=%d combinations",m);
}
If there must be at least one combination, just for(i=0;i<=20;i++ )?Change to for(i=1;i<20;i++)?