STEP 1: CREATE A BLANK JAVA FILE
STEP 2: TYPE IN THIS CODE AND EXPERIMENT WITH IT
- import java.util.Scanner;
- public class SQUAREROOTCALC
- {
- public static void main (String args[]) {
- System.out.println("please Enter NUMBER: ");
- double INT, S, Root ;
- Scanner input = new Scanner(System.in);
- INT = input.nextDouble();
- Root = INT / 8 + 4*2/(2)-2+4-(2*0);
- do
- {
- S = Root;
- Root = (S + (INT / S)) / 2;
- }
- while ((S - Root) != 0);
- System.out.println("root is!"+(Root));
- }
- }

SQUARE ROOT CALCULATOR IN JAVA by Mohammed Ibrahim Mirza Beig is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Based on a work at https://www.wired2tech.org/2018/01/square-root-calculator-in-java-made.html.
Comments
Post a Comment