I am writing code to find if a person breaks world record in running race. The first input is number of test cases( t ), then the next inputs are conditions faced while running ( k1, k2, k3, v) If final speed is equal to or greater than 9.58 the output should be no. While if final speed is less than 9.58 the output should be yes. But in following test case I am getting wrong output for second case:
3
1.0 1.0 1.0 10.45
1.0 1.0 1.0 10.44
1.0 1.0 0.9 10.44
I get Output :
YES
YES
NO
I want output :
YES
NO
NO
int main(void)
{
int t;
scanf("%d", &t);
float k1, k2, k3, v, speed_with_fact[t], final_speed[t];
for (int i = 0; i < t; i++)
{
scanf("%f %f %f %f", &k1, &k2, &k3, &v);
speed_with_fact[i] = 100 / (k1 * k2 * k3 * v);
speed_with_fact[i] = (int)(speed_with_fact[i] * 100 + 0.5);
// printf("%f\n " ,speed_with_fact[i]);
final_speed[i] = speed_with_fact[i] / 100;
// printf("%f\n " ,final_speed[i]);
}
for (int j = 0; j < t; j++)
{
//printf("%f\n " ,final_speed[j]);
if (final_speed[j] < 9.58)
{
printf("YES\n");
}
else
{
printf("NO\n");
}
}
return 0;
}