Runtime Error - Lucky Count (easy)

count
lucky
runtime

#1

Hi, I’m getting a runtime error for the code I wrote for lucky count problem in C
can anyone help me with the error(s)?

          #include<stdio.h>

    long int f(long int d,long int n)
      {
long int x=0;
while(n)
{
	if(n%10 == d)
		x++;
	n=n/10;
}
return x;
         }
               long int main(void)
           {
                         long int n,t;
                                 scanf("%d",t)
	while(t!=0)
	{
		long int count =0;
		long int i, r, l, s1,s2;
		scanf("%d",n);
		for(r=1;r<=n;r++)
		{

			for(l=1;l<=r;l++)
			{
				s1=0;
				s2=0;
				for(i=0;i<=r-l;i++)
				{ s1+=f(4,l+i);
				s2+=f(7,l+i);
				}
				if(s1==s2)
					count++;
			}
		}
		printf("%d",count);
		t--;
	}

	return 0;

}


#2

Syntax for scanning is wrong it should be &n