What does the following program print? public class Mystery { public static void main(String[] args) { int
Question:
What does the following program print?
public class Mystery {
public static void main(String[] args) {
int x = 1;
int total = 0;
while (x <= 10) {
int y = x * x;
System.out.println(y);
total += y;
++x;
}
System.out.printf("Total is %d%n", total);
}
}
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 80% (10 reviews)
1 4 9 16 ...View the full answer
Answered By
Madhvendra Pandey
Hi! I am Madhvendra, and I am your new friend ready to help you in the field of business, accounting, and finance. I am a College graduate in B.Com, and currently pursuing a Chartered Accountancy course (i.e equivalent to CPA in the USA). I have around 3 years of experience in the field of Financial Accounts, finance and, business studies, thereby looking forward to sharing those experiences in such a way that finds suitable solutions to your query.
Thus, please feel free to contact me regarding the same.
5.00+
1+ Reviews
10+ Question Solved
Related Book For
Java How To Program Early Objects
ISBN: 9780134743356
11th Edition
Authors: Paul Deitel, Harvey Deitel
Question Posted:
Students also viewed these Computer science questions
-
What does the following program segment output? d = 0; do { System.out.print(d + " "); d++; } while (d < 2); a. 0 b. 0 1 c. 0 1 2 d. Nothing
-
What does the following program segment output? for(f = 0; f < 3; ++f) for(g = 0; g < 2; ++g) System.out.print(f + " " + g + " "); a. 0 0 0 1 1 0 1 1 2 0 2 1 b. 0 1 0 2 0 3 1 1 1 2 1 3 c. 0 1 0 2 1 1...
-
What does the following program segment output? for(m = 0; m < 4; ++m); for(n = 0; n < 2; ++n); System.out.print(m + " " + n + " "); a. 0 0 0 1 1 0 1 1 2 0 2 1 3 0 3 1 b. 0 1 0 2 1 1 1 2 2 1 2 2 c. 4...
-
Dwights preferences over beer and whiskey satisfy more is better, but are concave (thus violating the usual assumption of convexity). a. On a diagram, sketch what such indifference curves would look...
-
Atomic physicists ignore the effect of gravity within an atom. To see why, calculate and compare the gravitational and electrical forces between an electron and a proton separated by 10-10 m. The...
-
After Dans EFN analysis for East Coast Yachts (see the Mini Case in Chapter 3), Larissa has decided to expand the companys operations. She has asked Dan to enlist an under-writer to help sell $50...
-
Priscilla Webster was dining at her favorite Massachusetts seafood restaurant when matters went horribly wrong. She began choking on a fishbone that had been lurking in her seafood chowder. After a...
-
Suppose the Xs in the following table indicate locations where fire sprinkler heads need to be installed in an existing building. The S indicates the location of the water source to supply these...
-
1. Convert the following iteration Even method to recursive method: (Ex: EVEN(0,10) Void enas iteration even(int Lint n) { } int i=1: while(i
-
For the double sampling plan N=2000, n1 =80, c1 = 1, r1 = 3, n2 = 100, c2 = 2, r2 = 3, construct and interpret the ASN curve. Suppose that process average nonconforming rate is 1.5%. Would you prefer...
-
Identify and correct the errors in each of the following pieces of code. a) int x = 1, total; while (x
-
What does the following program print? public class Mystery2 { public static void main(String[] args) { int count = 1; while (count
-
Find an equation of the plane tangent to the following surfaces at the given points. z = 2x + y; (1, 1, 3) and (0, 2, 4)
-
The general problem to be addressed is the failure of project managers, post-COVID-19, to successfully manage the team's demand for work-life balance with organizational and client needs, resulting...
-
PART 1 (30 marks Total)Purchasing Styles, there are 2 very distinct purchasing styles today. One is Public Sector Government based known as the Broader Public Purchasing System and the other...
-
Fat-E is under constant pressure to improve their products. In particular, reducing weight allows for better performance. Fat-E's design team has found a potential new supplier of the gear mechanism...
-
Crystal Water, a community committed to raise awareness towards water pollution in big cities, permission approved to install CCC an innovation water cleaning device. Administrative costs to obtain...
-
1) Traditionally supply chain management was considered as a back-office function. In the future it will be more about delivering a great customer experience. How will the supply chain of the future...
-
Let a, b, c B, a Boolean algebra. Prove that ab + c = a(b + c) if and only if c a.
-
If your school has a subscription to the FASB Codification, go to aaahq.org/ ascLogin.cfm to log in and prepare responses to the following. (a) What is the stock dividend? (b) What is a stock split?...
-
Th is Exercise examines the single error correcting, double error detecting (SEC/DED) Hamming code. 1. What is the minimum number of parity bits required to protect a 128-bit word using the SEC/DED...
-
For a high-performance system such as a B-tree index for a database, the page size is determined mainly by the data size and disk performance. Assume that on average a B-tree index page is 70% full...
-
As described in Section 5.7, virtual memory uses a page table to track the mapping of virtual addresses to physical addresses. This exercise shows how this table must be updated as addresses are...
-
Problem 5 (20/100): Ethane is burnt to supply enough heat to convert 50 kg of water at 10 C to steam at 100 C. The heat of combustion of ethane is 368 kcal/mol. Specific heat capacity of water is 1...
-
An adjusting entry that debits Sales Revenue and credits Refund Liability as well as debits Inventory-Estimated for Returns and credits Cost of Goods Sold is recording the ______. Multiple choice...
-
You are given 1 ETH on Sept 18th, 2020 worth $384. You sell the ETH on Oct 29th, 2021 for $4416. Group of answer choices You owe capital gains tax rate on 4416 in 2021. You owe personal income tax...
Study smarter with the SolutionInn App