ATM wrong answer

int main()

int w;

float b;

scanf("%d %f",&w,&b);





return 0;


test your program, its showing wrong ans for every testcase

check your print statement

1 Like

Check the printf() statement. That is wrong way to print out a float with 2 decimal points.

Change that to…

1 Like

When w=0 and b=120.00 then expected answer is 120.00 but your answer is 119.50. and when w=120 and b=120.00 then expected answer is 120.00 because account balance isn’t negative but your answer is -0.50.
So, please correct your code and any help then check this link - 


friend, you have made many mistakes

  1. when the complier starts he sees the main program but from where does the calculation in main program start you need to uses brace { and } for starting the body or you know the statements of main() function … so he will be able to know
  2. you havent used any header fle for eg stdio.h which contains the defination of printf so obiviously it will give you a error that is he is not able to find the protype of printf statement… note: header files are necessary

changed it but still wrong answer

“The cash machine will only accept the transaction if X is a multiple of 5, and Pooja’s account balance has enough cash to perform the withdrawal transaction (including bank charges).” Now check when w == b or (b - w) < 0.50 .