Q:

Calculate The Square Root Program Using Java

0

This Program is used to calculate the Square Root Program using Java

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

// program for finding the square root 

import java.io.*; 
import java.lang.*; 
import java.text.*; 

public class ssva08 

{ 
public static void main(String arg[]) 
{ 
double a,b,i,j; 
NumberFormat nf=NumberFormat.getInstance(); 
nf.setMaximumFractionDigits(2); 
NumberFormat nf1=NumberFormat.getInstance(); 
nf1.setMaximumFractionDigits(1); 
System.out.println("\n\t\tFinding Square Root\n"); 
for( i=0.0;i<=0.8;i=i+0.1) 
{ 

System.out.print("\t" + nf1.format(i)); 
} 
System.out.println(); 
System.out.println(); 
for( i=0.0;i<=8.0;i++) 
{ 
System.out.print(i); 
for( j=0.0;j<=0.8;j=j+0.1) 
{ 
a=Math.sqrt(i+j); 
System.out.print("\t" + nf.format(a)); 
} 
System.out.println(); 
} 
} 
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now