[FLOW005] What's wrong in my code?

problem code: FLOW005

code

#include <iostream>
#define ll long long
using namespace std;

bool is_decimal(long double number) {
    if(number == (ll)number) {
        return true;
    }else {
        return false;
    }
}
void calculate_denomination(ll total, ll &count) {
    if(total <= 0) {
        return;
    }
    if(is_decimal(total/100.00)) {
        count++;
        total -= 100;
        return calculate_denomination(total, count);
    }else if(is_decimal(total/50.00)) {
        count++;
        total -= 50;
        return calculate_denomination(total, count);
    }else if(is_decimal(total/10.00)) {
        count++;
        total -= 10;
        return calculate_denomination(total, count);
    }else if(is_decimal(total / 5.00)) {
        count++;
        total -= 5;
        return calculate_denomination(total, count);
    }else if(is_decimal(total / 2.00)) {
        count++;
        total -= 2;
        return calculate_denomination(total, count);
    }else if(is_decimal(total / 1.00)) {
        count++;
        total -= 1;
        return calculate_denomination(total, count);
    }
}

int main() {
	// your code goes here
	ll t;
	cin >> t;
	for(ll i=0; i<t; i++) {
	    ll inp; cin >> inp;
	    ll count = 0;
	    calculate_denomination(inp, count);
	    cout << count << "\n";
	}
	return 0;
}

Hey @srijeetb :wave: ,
your code is failing on test case
1
49496
Correct output is 501 and your output is 502.
Your is_decimal() function is creating issues you can simply check by (total/100) soo on this will by default convert the division into int format.
Here is your code with correction.

#include <iostream>
#define ll long long
using namespace std;

bool is_decimal(long double number) {
    if(number == (ll)number) {
        return true;
    }else {
        return false;
    }
}
void calculate_denomination(ll total, ll &count) {
    if (total <= 0) {
        return;
    }
    if (total / 100) {
        count++;
        total -= 100;
        return calculate_denomination(total, count);
    } else if (total / 50) {
        count++;
        total -= 50;
        return calculate_denomination(total, count);
    } else if (total / 10) {
        count++;
        total -= 10;
        return calculate_denomination(total, count);
    } else if (total / 5) {
        count++;
        total -= 5;
        return calculate_denomination(total, count);
    } else if (total / 2) {
        count++;
        total -= 2;
        return calculate_denomination(total, count);
    } else if (total / 1) {
        count++;
        total -= 1;
        return calculate_denomination(total, count);
    }
}
int main() {
	// your code goes here
	ll t;
	cin >> t;
	for(ll i=0; i<t; i++) {
	    ll inp; cin >> inp;
	    ll count = 0;
	    calculate_denomination(inp, count);
	    cout << count << "\n";
	}
	return 0;
}