/* Name of the class has to be “Main” only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
double amount_to_be_withdrawn,balance;
Scanner sc=new Scanner(System.in);
amount_to_be_withdrawn=sc.nextInt();
balance=sc.nextInt();
if(amount_to_be_withdrawn<balance)
{
double new_balance=balance-(amount_to_be_withdrawn+0.50);
System.out.println(new_balance);
/* Name of the class has to be “Main” only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
try
{
double amount_to_be_withdrawn,balance;
Scanner sc=new Scanner(System.in);
amount_to_be_withdrawn=sc.nextFloat();
balance=sc.nextFloat();
if(amount_to_be_withdrawn%5==0 && amount_to_be_withdrawn+0.50<balance)
{
double new_balance=balance-(amount_to_be_withdrawn+0.50);
System.out.println(new_balance);
@noobcoder37 Still your code is messed up, well you can learn about using the forum as @ssjgzsuggested in the above comments.
For now you can share your submission link.
/* Name of the class has to be “Main” only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
try{
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
float y = sc.nextFloat();
if(x%5==0 && y>=(x+0.5)){
System.out.printf(“%.2f”,y - (x+0.5));
}
else{
System.out.printf(“%.2f”,y);