Not able to get the answer! Whats wrong with my code?

This is my code for the following problem -->
My Code

using namespace std;

int main()
int withdraw;
float amount;

return 0;

hey @agnesj0315

there are basically 3 mistakes in your code

  1. your code does not give any output if withdrawal amount in not a multiple of 5.that means you have not used if else loop properly.

2)this line is wrong amount-withdraw-0.05 as you can see in the question the bank charges are 0.5 not 0.05

3)as you can see the output have 2 decimal places,so in order to get that you have to use fixed & setprecision(2),and have to include #include iomanip

here is link to your code modified by me link text

happy coding


Thank you!! It works! :smiley:
Cant believe I didnt notice that extra zero! Oops!