#include
#include
using namespace std;
int main() {
int withdraw; float bal;
cin>>withdraw>>bal;
if(withdraw%5==0){
if(bal>=(withdraw+0.50)){
bal=bal-withdraw-0.50;
cout<<fixed<<setprecision(2)<< bal;
}
}
else{
cout<<bal<<endl;
}
return 0;
}
What question? Please share the problem link.
you didn’t cover the insufficient fund case . what balance would you display if (bal<withdraw+0.50)?
int withdraw; float bal;
cin>>withdraw>>bal;
if(withdraw%5==0){
if(bal>=(withdraw+0.50)){
bal=bal-withdraw-0.50;
cout<<fixed<<setprecision(2)<< bal;
}
else {
cout << bal << endl;
}
}
The additional part added is this:
else {
cout << bal << endl;
}