import java.util.Scanner;
class numb
{
public static void main(String …k)
{
Scanner sc=new Scanner(System.in);
System.out.println(“input amount”);
int amount=sc.nextInt();
System.out.println(“input balance”);
double balance=sc.nextDouble();
if(amount%5==0&&(balance-amount+0.50)>=0)
System.out.format("%.2f",(balance-amount-0.50));
else
System.out.format("%.2f",balance);
}
}
Dont use your own prompt statements:Remove the input amount statement.Use only the input format given to you in the question. rest…check back if youve got an error again.
you need not to write anything other than asked.remove “input balance” and “input amount”.rest is ok…i think so
it is still generating a wrong answer
hey @niyati21
remove String…k with String args[] and you are good to go…your solution modified by me got AC… hope this will help…
i added parenthesis in the if…(amount+0.50) it worked … thank you all