• Lenguaje

    Java usando Scanner

  • Descripción

    Hallar la radicación de ⁿ⎷a, done a y n pertenecen a números enteros positivos

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import java.util.Scanner;

public class Radicacion {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        double a, n, resultado;
        System.out.print("Ingresa el valor de a: ");
        a = in.nextDouble();
        in.nextLine();
        System.out.print("Ingresa el valor de n: ");
        n = in.nextDouble();
        in.nextLine();
        resultado=Math.pow(a,1.0/n);
        System.out.println("Valor de resultado: " + resultado);
    }

}