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.

1
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:

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

One comment

Add comment