The program below is the answer to Deitel’s Java How to Program (9th Edition) Chapter 2 Exercise 2.31.

Question: Using only the programming techniques you learned in this chapter, write an application that calculates the squares and cubes of the numbers from 0 to 10 and prints the resulting values in table format, as shown below. [Note: This program does not require any input from the user.]

3 Comments

  1. how can i do this exact problem but with a while loop in it?
    in simple form.

  2. @Alex-Kun Yes, you can but the question states that "only programming techniques learnt in the chapter(chapter 2) of the book" should be used.

Write A Comment