SquareCubeRoot1 - Calculate and print values for i = 0...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import chapman.io.*; public class SquareCubeRoot1 { public static void main(String[] args) { // Declare variables, and define each variable int i; // Loop index double cubeRoot; // Cube root of index double squareRoot; // Square root of index // Print title System.out.println("Table of Square and Cube Roots:");
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: // Calculate and print values for ( i = 0; i <= 10; i++ ) { squareRoot = Math.sqrt(i); cubeRoot = Math.pow(i,1./3.); Fmt.printf("%5d",i); Fmt.printf(" %7.5f",squareRoot); Fmt.printf(" %7.5f\n",cubeRoot); } } }...
View Full Document

This note was uploaded on 12/01/2010 for the course APPLIED SC 142 taught by Professor Professorstansimmons during the Winter '10 term at Queens University.

Ask a homework question - tutors are online