• Lenguaje

    Java usando Scanner

  • Descripción

    Leer dos números y mostrar el producto.

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

public class ProductoDe2Numeros {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        double a, b, producto;
        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();
        producto=a*b;
        System.out.println("Valor de producto: " + producto);
    }

}