TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Root calculation for the given number using Java
Senthilvelan Sambamoorthy
Aug 13
2016
Code
559
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
ssvroot.rar
// 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)));
}
}
}
}
Java