Errors in Heaven to Earth that Im unable to find

There seems to be an error in my code which I am unable to find.Could you guys tell me what went wrong ? New to coding so apologies for the formatting.

#include<stdio.h>
#include<math.h>
int main()
{
int N,V1,V2,t1,t2;
int t;
scanf("%d",&t);
for(int i=0;i<t;i++)
{scanf("%d %d %d",&N,&V1,&V2);
int t1i = sqrt(2) * N;
t1= t1i / V1;
int t2i = 2 * N;
t2 = t2i / V2;
if(t1<t2)
printf("Stairs\n");
else printf("Elevator\n");
}
return 0;
}

int t1i = sqrt(2) * N;

I dont recall K*\sqrt{2} being an integer to be stored in int data type.

Similarly t1, t2 must be double/float as well. These values can be decimal.

1 Like