Computer Science, asked by MyNameIsPrinceGupta, 1 year ago

A Java program in BlueJ to find the square root a number ...

Answers

Answered by mohanmanjhi5
1
Java Program
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*Java program to find out square root of a given number
* without using any Built-In Functions
*/
public class SquareRootDemo2
{

public static void main(String[] args)
{
//Number for which square root is to be found
double number = -12;

//This method finds out the square root
findSquareRoot(number);

}

/*This method finds out the square root without using
any built-in functions and displays it */
public static void findSquareRoot(double number)
{

boolean isPositiveNumber = true;
double g1;

//if the number given is a 0
if(number==0)
{
System.out.println("Square root of "+number+" = "+0);
}

//If the number given is a -ve number
else if(number<0)
{
number=-number;
isPositiveNumber = false;
}

//Proceeding to find out squ
Answered by sujit21
2
I Hope its helps u alot.
Attachments:
Similar questions