-
Lenguaje
Java usando Scanner
-
Descripción
Calcular el valor de z, dados a, b, c, y d en la Ecuación z=(a+b-c/d).
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 ZABCD {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
double a, b, c, d, z;
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();
System.out.print("Ingresa el valor de c: ");
c = in.nextDouble();
in.nextLine();
System.out.print("Ingresa el valor de d: ");
d = in.nextDouble();
in.nextLine();
z=(a+b-c/d);
System.out.println("Valor de z: " + z);
}
}
public class ZABCD {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
double a, b, c, d, z;
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();
System.out.print("Ingresa el valor de c: ");
c = in.nextDouble();
in.nextLine();
System.out.print("Ingresa el valor de d: ");
d = in.nextDouble();
in.nextLine();
z=(a+b-c/d);
System.out.println("Valor de z: " + z);
}
}