Problem Code:[HS08TEST]
#include
#include <bits/stdc++.h>
using namespace std;
int main() {
//your code goes here
float balance=0.0;
float withdraw=0;
cin>>withdraw;
cin>>balance;
if((fmod(withdraw,5))||(withdraw>=balance)||(withdraw>2000)||(balance>2000)||(withdraw==0))
cout<<balance;
else
{
balance-=(withdraw+0.50);
cout.precision(2);
cout.setf(ios::fixed);
cout<<balance;
}
return 0;
}
its still giving wrong answer.
thanks in advance!
Dont use type int for ‘withdraw’, there’s typecasting issue when you are add 0.5 to the int type variable withdraw, use float withdraw instead
oh okay. thank you very much! i am new to programming, sorry for silly miistakes.

Problem Code:[HS08TEST]
#include
#include <bits/stdc++.h>
using namespace std;
int main() {
//your code goes here
float balance=0.0;
float withdraw=0;
cin>>withdraw;
cin>>balance;
if((fmod(withdraw,5))||(withdraw>=balance)||(withdraw>2000)||(balance>2000)||(withdraw==0))
cout<<balance;
else
{
balance-=(withdraw+0.50);
cout.precision(2);
cout.setf(ios::fixed);
cout<<balance;
}
return 0;
}
its still giving wrong answer.
thanks in advance!