#include<stdio.h>
main()
{
int a;
float b;
scanf("%d",&a);
scanf("%f",&b);
if(a>0 && a<=2000 && b>0 && b<=2000)
{
if(a%5==0)
{
if( b>=(a+.50))
{
b=b-a-0.5;
printf("%0.2f",b);
}
if(b< a+.5)
printf("%0.2f",b);
}
else
printf("%0.2f",b);
}
}
What is wrong with this code?
#include<stdio.h>
int main(){
unsigned int amt;
float atm=0.5,bal,rlt;
scanf("%u %f",&amt,&bal);
if((bal+atm)>=amt && amt%5==0 && (0<=bal<=2000) && (0<amt<=2000))
rlt=bal-(amt+atm);
printf("\n%.2f",rlt);
return 0;
}
whats wrong in my code
amnt ,bal = [float(x) for x in input().split()]
print(bal,amnt)
if(amnt > 0 and bal > 0):
if(amnt <= 2000.00 and bal <= 2000.00):
if(amnt+0.5 <= bal and amnt%5 == 0 ):
print(format(bal-amnt-0.50,".2f"))
else:
print(format(bal,".2f"))
whats wrong in this
#include <stdio.h>
#include <stdlib.h>
int main()
{
int transaction;
double balance, response, charges;
balance=2000;
charges=0.50;
printf("\n ATM Machine");
printf("\n------------------");
printf("\n1 Enter the Saving Account");
printf("\n2 Enter the Withdraw money");
printf("\n3 Quit");
printf("\nEnter your Selection:");
scanf("%lf", &response);
if(response==1)
{
printf("\n---------------------");
printf("\nYour current balance: %0.2lf", balance);
printf("\n---------------------");
printf("\nThank you\n");
}
if(response==2)
{
printf("\nEnter amount to withdraw:");
scanf("%d", &transaction);
if((transaction)%5==0)
{
printf("\n---------------------");
printf("\nYour current balance: %0.2lf", balance-transaction-charges);
printf("\n---------------------");
printf("\nThank you for Transaction\n");
}
else
{
printf("\nTransaction Failed");
}
}
if(response==3)
{
printf("\nThank you\n");
}
return 0;
}
Brother, check this code. And tell me what’s wrong on it.
#include <stdio.h>
int main(){
unsigned int amount;
float balance;
scanf ("%d %f",&amount,&balance);
if (balance>=0 && balance <=2000){
if (amount<=(balance-0.5) && amount>0){
if(amount%5==0)
printf("%f",(balance-amount)-0.5);
}
}
return 0;
}
what is the error here? please help me
import java.util.Scanner;
import java.text.DecimalFormat;
class Atm{
public static void main(String[] args){
Scanner s=new Scanner(System.in);
System.out.println("enter amt to be withdrawn:");
double a=s.nextDouble();
System.out.println("enter the current amount in account");
double b=s.nextDouble();
DecimalFormat df=new DecimalFormat("#### 0.00");
if((0<a)&&(0<b)){
if((a<=2000.00)&&(b<=2000.00)){
if(a>b)
System.out.println(df.format(b));
if((a%5)!=0)
System.out.println(df.format(b));
if(((a%5)==0)&&(a==b))
System.out.println(df.format(b-a));
if(((a%5)==0)&&(a<b))
System.out.println(df.format((b-a)-0.50));
}
}
}
}
How to get input in python? Example for python here in forum doesn’t work like:
wd_amt,in_amt = list(map(float, input().split()))