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

NoSuchElementException error

$
0
0

I am getting a NoSuchElementException error in the following code while running it here but I am not getting any error when I run it on eclipse.

Any help would be appreciated .

problem :http://www.codechef.com/problems/HS08TEST

code:

import java.util.; import java.io.;

public class atm

{

public static void main(String[] args)

{


    double w,c;



    Scanner input=new Scanner(System.in);

    w=input.nextDouble();  //it is giving error at this line

    c=input.nextDouble();

    if(w%5==0&&w<=(c+.5))

    {


        c=c-w-.5;

        System.out.printf("%.2f",c);

    }

    else if(w%5==0&&w>c)

        System.out.printf("%.2f",c);

    else if(w%5!=0)

        System.out.printf("%.2f",c);



}

}


Viewing all articles
Browse latest Browse all 39796

Trending Articles



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