 # Flow009 question,i am begineer

All submissions for this problem are available.

While purchasing certain items, a discount of 10% is offered if the quantity purchased is more than 1000.
If the quantity and price per item are input, write a program to calculate the total expenses.

### Input

The first line contains an integer T , total number of test cases. Then follow T lines, each line contains integers quantity and price .

### Output

Output the total expenses while purchasing items.

### Constraints

• 1 T 1000
• 1 quantity,price 100000

### Example

Input 3 100 120 10 20 1200 20 Output 12000.000000 200.000000 21600.000000

this is my code ,i am not getting true answer still my logic is true
#include <stdio.h>

int main(void) {
int t;
long int p,q;
float b;
scanf("%d",&t);
while(t–)
{
scanf("%ld %ld",&q,&p);
b=qp;
if(q>1000)
{
b =0.9
b;
}
printf("%.6f\n",b);
}
return 0;
}

1 Like

But in question it said that more than 1000 not more than ya equal to

1 Like

Just use double instead of float and it’ll work just fine. (If possible, delete float from your memory)

Single precision (float) gives you 23 bits of significand, 8 bits of exponent, and 1 sign bit.

Double precision (double) gives you 52 bits of significand, 11 bits of exponent, and 1 sign bit.

1 Like

@anup31

I found some mistakes in your code.

• Variable “b” needs to be a double.
• For multiplying two numbers, you must use “*” operand.
• For the testcases loop, you must loop until “t” is zero and subtract 1 for each case.