Q:

Root calculation for the given number using Java

0

This Program is used to Root Calculation for the given number usinfgJava

All Answers

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

// Root Calculation for given numbers 
import java.io.*; 
import java.text.*; 
import java.math.*; 

class ssvroot 
{ 
public static void main(String arg[])throws IOException 
{ 
double i,j,x,n; 

System.out.print("Enter the float for table limit :"); 
BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); 
n=Double.parseDouble(br.readLine()); 

NumberFormat nf=NumberFormat.getInstance(); 
nf.setMaximumFractionDigits(2); 
System.out.print("No :"); 

for(i=0;i<=n;i=i+0.1) 
{ 
System.out.print("\t"+ nf.format(i) ); 
} 
System.out.println(); 

for(i=0;i<=9.0;i=i+1.0) 
{ 
System.out.print("\n" + i); 
for(j=0;j<=n;j=j+0.1) 
{ 
x=i+j; 
System.out.print("\t"+ nf.format(Math.sqrt(x))); 
} 
} 

} 
}

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