# ATM ques what is error in this

x,y = map(float,raw_input().split())
if y > 0.0:
if x<=y:
if y == 0.5 and x == 0:
print y-x-0.5
elif (x%5.0) == (0 or 0.5 or 0.05):
print y-(x+0.50)
else:
print “%.2f”y else: print ".2f"%y

``````else:
print "%.2f"%y
``````

help please tell whats the error in this…

if y == 0.5 and x == 0:
print y-x-0.5

this is wrong.
If x==0, it means you are withdrawing nothing,so 0.5 wont be deducted.

You just need to check (current balance - money to be withdraw)>=0.5 and money to be withdraw is a multiple of 5 or not. Both condition should be simultaneously true.

// write a program to make transaction after withdrawl of money from atm.
#include<stdio.h>
#include<conio.h>
int main()
{
int x;
float amt;
printf(“Enter amount in account”);
scanf("%f",&amt);
printf(“Enter withdrawl money”);
scanf("%d",&x);

if(amt>x)
{
if((x%5)==0)
{
printf(“successful transaction”);
amt=amt-x-0.5;
printf(".2f",amt); } else { printf("incorrect withdrawl amount"); printf(".2f",amt);
}

}
else
{
printf(“insufficient funds”);
printf("%.2f",amt);
}
getch();
}