Code is not giving any error.
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
// your code goes here
int vdraw;
float mbal;
float cut = 0.50;
float rem;
std::cin >>vdraw>>mbal;
float calc = vdraw % 5;
if((vdraw < mbal) && (calc == 0))
{
rem = mbal - (vdraw + cut) ;
std::cout << std::fixed << std::setprecision(2) << rem;
}
else
{
std::cout << std::fixed << std::setprecision(2) << mbal;
}
return 0;
}
I have modified it according to your suggested test case, but still it is giving same status.
Provide the modified version of your code.
1 Like
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
// your code goes here
int vdraw;
float mbal;
float cut = 0.50;
float rem;
std::cin >>vdraw>>mbal;
/*on each transaction we have to cut 0.50$US therefore the main balance should
contain money which the customer want to withdraw and + 0.50$US.*/
float satisfy = vdraw + cut; // to calculate the tax on each transaction
float calc = vdraw % 5;
if((satisfy < mbal) && (calc == 0))
{
rem = mbal - (vdraw + cut) ;
std::cout << std::fixed << std::setprecision(2) << rem;
}
else
{
std::cout << std::fixed << std::setprecision(2) << mbal;
}
return 0;
}
Thanks for your suggestions. I have successfully submitted solution code.