Java

Root calculation for the given number using Java

Root calculation for the given number using Java
// 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))); 
} 
} 

} 
}
Senthilvelan Sambamoorthy

Senthilvelan Sambamoorthy is working as a Professor in Department of Master of Computer Applications, Paavai Engineering College, Namakkal, Tamilnadu, India, He is Masters in Computers Applications. Having 18+ years of experience and his area of interest is Java, JSP, Servlet, J2EE, C#, PHP, Python ASP.NET, SQL Server and etc.