• Lenguaje

    Java usando Scanner

  • Descripción

    Dado los datos enteros A y B, escriba el resultado de la siguiente expresión: (A+B)^2/3

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

public class FxAB23 {

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

}