The following loop is intended to list the world population for (int i =0; i < 7694561082;
Question:
The following loop is intended to list the world population for (int i =0; i < 7694561082; i++) {
System.out.println(i); }
a) The program does not compile, why? Fix the errors.
b) You will find that your program takes a long time to run. The problem is calling System.out.println because this operation takes a comparatively long time. One way to speed up the program is to only output part of the numbers. Extend the program so that the user is asked for a number n. Then the program should no longer output every number, but only every nth number.
c) How much memory is required to store all the numbers in the enumeration? Enter your result in gigabytes and your method of calculation.
Introduction To Probability And Statistics
ISBN: 9781133103752
14th Edition
Authors: William Mendenhall, Robert Beaver, Barbara Beaver