All pastes #454487 Raw Edit

Someone

public text v1 · immutable
·published 2007-04-23 17:11 UTC
rendered paste body
/* This

*/

import java.text.*;
public class Roots2  {

       //define method
       public static void main(String [] args)throws Exception  {
                                                                  	
      
      //Declares variables
      int k;                                                       //integer van een getal
      double square;                                               //kwadraat van het getal
      double root;                                                 //wortel van het getal
      String str;
      
      //
      DecimalFormat df1 = new DecimalFormat ("00");
      DecimalFormat df2 = new DecimalFormat ("0.000");


      //While Loop to calculate and print the squares and roots
      k = 0;
      while ( k <= 50)  {
            square = k*k;
            root = Math.sqrt(k);
            System.out.println(df1.format(k) + "\t" + df2.format(square) + "\t" + df2.format(root));

            k++;

      }

	  System.in.read();

        }}
      
      //Calculate the result
      
      
      //Tell user the answer