-
Lenguaje
Java usando Scanner
-
Descripción
Ingrese cuatro números que sume los primeros dos datos, el resultado lo multiplique por la suma de los últimos dos números.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import java.util.Scanner;
public class MultiplicacionDeSumas {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
double N1, N2, N3, N4, R1;
System.out.print("Ingresa el valor de N1: ");
N1 = in.nextDouble();
in.nextLine();
System.out.print("Ingresa el valor de N2: ");
N2 = in.nextDouble();
in.nextLine();
System.out.print("Ingresa el valor de N3: ");
N3 = in.nextDouble();
in.nextLine();
System.out.print("Ingresa el valor de N4: ");
N4 = in.nextDouble();
in.nextLine();
R1=(N1+N2)*(N3+N4);
System.out.println("Valor de R1: " + R1);
}
}
public class MultiplicacionDeSumas {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
double N1, N2, N3, N4, R1;
System.out.print("Ingresa el valor de N1: ");
N1 = in.nextDouble();
in.nextLine();
System.out.print("Ingresa el valor de N2: ");
N2 = in.nextDouble();
in.nextLine();
System.out.print("Ingresa el valor de N3: ");
N3 = in.nextDouble();
in.nextLine();
System.out.print("Ingresa el valor de N4: ");
N4 = in.nextDouble();
in.nextLine();
R1=(N1+N2)*(N3+N4);
System.out.println("Valor de R1: " + R1);
}
}