2. Write a program to print the numbers and use the continue statement when n=10. (Note n should be more than 10)
1
Expert's answer
2011-08-16T11:55:33-0400
import java.util.Random;
public class ContinueWhen10 { public static void main(String[] args) { Random generator = new Random(); int n = generator.nextInt(20) + 11; System.out.println("The total amount of numbers (n) = " + n); for (int i = 0; i < n; i++) { if (i == 10) continue; System.out.print(i + " "); } } }
Comments
Leave a comment