63 046
Assignments Done
99,1%
Successfully Done
In July 2018

Answer to Question #57965 in Java | JSP | JSF for Kenya

Question #57965
Write a Java program that displays a table of square roots and cube roots. Use a loop to print the roots of numbers from 0 to 100, in increments of 5, as shown below. Output formatted columns with the number of decimal places as shown.

roots table
Expert's answer
public class Main {

public static void main(String[] args) {

System.out.println("square root cube root");

for (int i = 0; i < 101; i+=5) {
System.out.printf("%03d = %07.4f %03d = %07.4f%n",i, Math.sqrt(i), i, Math.cbrt(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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions