Answer to Question #3497 in Java | JSP | JSF for Y mukundareddy

Question #3497
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 + " ");
}
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS