Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 40121

[ATM problem] What is wrong here? I am getting NZEC error.

$
0
0
package main;


import java.util.Scanner;


public class Main {


public static void main(String[] args)  {
   int balance;
   double withdraw = 0;



    Scanner s=new Scanner(System.in);

    System.out.println("Enter balance: ");
    balance=s.nextInt();
    System.out.println("Enter the amount to withdraw: ");
    withdraw=s.nextInt();

    if(withdraw%5==0 && balance>(withdraw+0.50)){

    System.out.println("Remaining balance: "+(balance-withdraw-0.50));
    }
    else{
    System.out.println("Not enough balance: "+balance);
        System.exit(0);
    }
}


}

Viewing all articles
Browse latest Browse all 40121

Trending Articles