SIGFPE error ,SIGSEPE errors

what the heck is wrong with this code , it absolutely works fine in codeblocks
is this the platform error ?
#include<stdio.h>
#include<math.h>
int main()
{
int n,a,b,t;int res[n];
scanf("%d",&n);long long b2;long long a2;
for(int i =0; i<n; i++)
{
scanf("%d %d %d",&a,&b,&t);
a2=a;b2=b;
for (int i =0 ; i<t;)
{
a2=a22;i=i+1;
if(i!=t)
b2= b2
2;i=i+1;
}

    if(a2>b2)
    {
        res[i] = a2/b2;
    }
    else
    {
        res [i]= b2/a2;
    }

}
for (int i =0 ; i<n;i++){
    printf("%d\n",res[i]);
}
return 0;

}

1 Like

Please either format your code or (better!) link to your submission - the forum software has mangled it and it won’t compile! :slight_smile:

Also - what Problem are you trying to solve?

Also also: Are you trying to “Run” without Providing “Custom Input”?

Edit:

     int n,a,b,t;int res[n];

You’re declaring an array of size n when n hasn’t been initialised, yet. Your compiler should be warning you about this - if it isn’t, use a better one :stuck_out_tongue:

2 Likes

It’s funny to see how people blame others even if the fault is at their end. :laughing:

1 Like