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

why this java code is showing a runtime error.

$
0
0
import java.util.Scanner;
public class ATM{
    public static void main(String[] args){
        Scanner ip = new Scanner(System.in);
        double bal = ip.nextDouble();
        int amt = ip.nextInt();
        if((bal>=0&&bal<=2000)&&(amt>0&&amt<=2000)){
            if((bal>amt+0.5)&&(amt%5==0)){
                bal-=(amt+0.5);
                System.out.println(bal);}
        else System.out.println(bal);
        }
    }
}

RESULT : RUNTIME ERROR Doubt ; Y is it so? it is working on pc


Viewing all articles
Browse latest Browse all 40121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>