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
Calculate The Square Root Program Using Java
Senthilvelan Sambamoorthy
Aug 12
2016
Code
521
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
ssva08.rar
// 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();
}
}
}
Java
Square Root Program