Suppose that the code below is the body of some loop. Use a continue statement to make sure that nothing is written to standard out when y is 0.

LANGUAGE: JAVA

CHALLENGE:

Suppose that the code below is the body of some loop. Use a continue statement to make sure that nothing is written to standard out when y is 0.

SOLUTION:

The Bad News: The content you are trying to access is only available to members.

The Good News: You too can be a member, simply Click Here.

Already a member?

Posted in ,

1 Comment

  1. j p on July 12, 2017 at 3:50 am

    Use this:

    int x = stdin.nextInt();
    int y = stdin.nextInt();
    if (y == 0) continue;
    System.out.println(x / y);

Leave a Comment

You must be logged in to post a comment.