方程x1+x2+x3+x4=30有多少满足x1>=2,x2>=0,x3>=-5,x4>=8的整数解?(用for循环或while循环实现)
#include <stdio.h>
int main()
{
int x1,x2,x3,x4,i=0;
for(x1=2;x1<=27;x1++){
for(x2=0;x2<=25;x2++){
for(x3=-5;x3<=20;x3++){
for(x4=8;x4<=33;x4++){
if(x1+x2+x3+x4==30)
i++;
}
}
}
}
printf("%d\n",i);
return 0;
}