1. Write a program to print n umbers and break the program when n==10.
1
Expert's answer
2011-08-16T11:55:02-0400
import java.util.Random;
public class BreakWhen10 { public static void main(String[] args) { Random generator = new Random(100); int n = generator.nextInt(20) + 10; System.out.println("The total amount of numbers (n) = " + n); for (int i = 0; i < n; i++) { System.out.print(i + " "); if (i == 10) break; } } }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment