Why is my answer not being accepted?

My answer for calculating discount give correct outputs, but it is not accepted.
Problem : Total expenses
Problem Code: FLOW009

int main(void) {
	// your code goes here
	int t;
	scanf("%d", &t);
	for(int i = 0; i<t; i++){
	    int a, b;
	    float tot_price;
	    scanf("%d %d", &a, &b);
	    if(a > 1000){
	        tot_price = (a*b) - round(a*b*0.1);
	    } else{
	        tot_price = a*b;
	    }
	    printf("%f\n", tot_price);
	}
	return 0;
}

You have to use setprecision(6) and fixed, so that 6 decimal places are printed.
Check this out

1 Like

just use datatype double instead of float
Note: Also change %f to %lf as datatype is change.
And dont use round function.

https://www.codechef.com/viewsolution/35620162
This is modified solution of your code

Cool, thanks so much, guys

Why is my answer not being accepted?
CONTEST CODE : PRACTICE
PROBLEM CODE: FRUITS

#include <stdio.h>

int main(void) {
	// your code goes here
	int t;
	scanf("%d", &t);
	for(int i = 0; i<t; i++){
	    int m, n, k, c, d;
	    scanf("%d %d %d", &n, &m, &k);
	    c = m > n ? n : m;
	    d = m > n ? m : n;
	    while(k > 0){
	        c++;
	        if( c == d ){
	            break;
	        }
	        k -= 1;
	    }
	    printf("%d\n", (d-c));
	}
	return 0;
}