Run time errot atm problem

import java.util.*;
public class Main {

public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    System.out.println("ENTER AMOUNT OF MONEY PRESENT IN ACCOUNT");
    double y = sc.nextDouble();
    //System.out.println();
    System.out.println("ENTER AMOUNT FOR WITHDRAWAL");
    int x = sc.nextInt();
    if(x%5!=0) {
        System.out.println("Enter again");
        x = sc.nextInt();
    }
    double z= y-x-0.50;
    if(z>0)
    { System.out.println("REMAINING AMOUNT IS "+ z);
    }else{
        System.out.println("insufficient funds");
    }
}}

I don’t know whether your code is correct and will be AC, as you have NOT included the link to problem statement.

But looking at your code, to solve the run time error:

    Scanner sc = new Scanner(System.in);
    if (sc.hasNext()) { // Updated Line
        double y = sc.nextDouble();
        int x = sc.nextInt();
        if (x % 5 != 0) {
            if (sc.hasNext()) { //Updated Line
                x = sc.nextInt();
            }
        }
        double z = y - x - 0.50;
        if (z > 0) {
            System.out.println("REMAINING AMOUNT IS " + z);
        } else {
            System.out.println("insufficient funds");
        }
    }
    sc.close();

Comments are the updated lines. And removed unnecessary print statements other than output ones.