I was trying to do the codechef question - https://www.codechef.com/problems/FLOW009
Here, my code (submitted successfully )is this -
int main(void) {
   int testCases;
   scanf ("%d\n", &testCases);
   while (testCases--) {
       float q,p;
       scanf ("%f%f", &q,&p);
       if (q >= 1000){
           printf("%.6f\n",q*p - (q*p*0.1));
       }
       else{
           printf("%.6f\n", q*p);
       }
   }
   return 0;
} 
This was submitted successfully... But however when i tried this code -
int main(void) {
   int testCases;
   scanf ("%d\n", &testCases);
   while (testCases--) {
       float q,p;
       scanf ("%f%f", &q,&p);
       if (q >= 1000){
           float a = q*p - (q*p*0.1);
           printf("%.6f\n",a);
       }
       else{
           printf("%.6f\n", q*p);
       }
   }
   return 0;
} 
It said wrong answer. In my compiler the results are same for all the test cases. What is happening. The first code- i am just printing the value. In the second - i am using a variable to store the value.
PS - i tried typecasting the value also but with no result.
 
    