#include <stdio.h>
int fact(int x,int y)
{
int i,f=1,fa=1,fac=1,z;
if(x>=y)
{
for(i=1;i<=x;i++)
{
f=fi;
}
for(i=1;i<=y;i++)
{
fa=fai;
}
for(i=1;i<=abs(x-y);i++)
{
fac=faci;
}
z=f/(fafac);
return(z);
}
else
{
z=xy;
return(z);
}
}
int main()
{
int t,a,b,c,d,p=1,s=0,i,j,k;
scanf("%d",&t);
for(i=1;i<=t;i++)
{
scanf("%d %d %d %d",&a,&b,&c,&d);
for(j=a;j<=b;j++)
{
for(k=c;k<=d;k++)
{
p=pfact(j,k);
}
s=s+p;p=1;
}
printf("%d\n",s);s=0;p=1;
}
}
for(i=1;i<=abs(x-y);i++)
{
fac=fac*i;
}
z=f/(fa*fac);
When x and y are equal then fac will be 0 at some instance
Then you are dividing a number by 0 that’s why I think you’re getting the error Admin
s answer
Problem code please.