Quantcast
Viewing all articles
Browse latest Browse all 39796

What is wrong with this code for the ATM problem?

Everytime I compile it, I get correct answers. But when I submit it here, it says wrong answer. [http://www.codechef.com/viewsolution/1015864 ]

import java.util.Scanner;
 class ATM
 {
    public static void main(String[] args)
    {
        int wd;
        double ab;
        Scanner sc=new Scanner(System.in);
        wd=sc.nextInt();
        ab=sc.nextDouble();
        if (wd%5==0 && (ab+0.5)>wd)
        {
            ab=ab-wd-0.5;
        }
            System.out.printf("%.2f",ab);
    }
 }

Viewing all articles
Browse latest Browse all 39796

Trending Articles



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