Squareroots.java
// Squareroots.java - Print Square Roots of 1 - 10Public Class Squareroots {public static void main (string [] args) {INT i; double square_root; for (i = 1; i <= 10; i ) {square_root = Math . SQRT (I); System.out.Println ("The Square Root of" I "IS" Square_root);} System.out.println ("That's all!");}}
Squareroots2.java
// SquareRoots2.java - replace for with whilepublic class SquareRoots2 {public static void main (String [] args) {int i; double square_root; i = 1; // initialization-expr while (i <= 10) {square_root = Math . SQRT (I); System.out.Println ("The Square Root of" I "IS" Square_root); i ; // iprintln ("That's all!");} }
Finally, learn about the local variable declaration in the FOR statement.