why i am getting Runtime Error(SIGSEGV) on submitting following code?
can anyone please help me??
#include<stdio.h>
int main()
{
int t,a,r[10000],b,n,i;
scanf("%d",&t);
while(t>0)
{
scanf("%d%d",&a,&b);
scanf("%d",&n);
r[1]=a;
r[2]=b;
for(i=3;i<=n;i++){
r[i]=r[i-1]-r[i-2];
}
if(r[n]>=0)
printf("%d\n",r[n]);
else
printf("%d",r[n]+1000000007);
t--;
}
return 0;
}