Answers for "find root of a number in java"

0

finding a given root if a number java

Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();//the number of which i want to find the root
        System.out.println("enter the root:");
        int rootNum = sc.nextInt();//the N-th number root
        double powerOf = 1;
        double sqrt = 0;
        double b = 1;
        while (a > b) {
        	sqrt = powerOf + 0.0000001;//flexible
        	powerOf = sqrt;
        	for(int i = 1; i < rootNum; i++) {
        		b = sqrt*powerOf;
        		sqrt = b;
        		}
        }
Posted by: Guest on August-27-2021
0

finding a given root if a number java

Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();//the number of which i want to find the root
    System.out.println("enter the root:");
    int rootNum = sc.nextInt();//the N-th number root
    double powerOf = 1;
    double sqrt = 0;
    double b = 0;
    while (a > b) {
    	sqrt = powerOf + 0.0000001;//flexible
    	powerOf = sqrt;
    	for(int i = 1; i < rootNum; i++) {
        	b = sqrt*powerOf;
        	sqrt = b;
        	}
		}
Posted by: Guest on August-27-2021

Code answers related to "find root of a number in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language