-
Lenguaje
Pascal
-
Descripción
Calcule el valor de R de acuerdo a la siguiente relación:
R = (A * B) / (C * D) Si X * Y > 0
R = (A + B) / (C + D) Si X * Y = 0
R = (A + B) – C + D Si X * Y < 0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
program ValorDeR;
uses crt;
var A, B, C, D, R : real;
var X, Y : real;
begin
write ('Ingresa el valor de A: ');
readln (A);
write ('Ingresa el valor de B: ');
readln (B);
write ('Ingresa el valor de C: ');
readln (C);
write ('Ingresa el valor de D: ');
readln (D);
write ('Ingresa el valor de X: ');
readln (X);
write ('Ingresa el valor de Y: ');
readln (Y);
R := 0;
if X*Y>0 then
begin
R := (A*B)/(C*D);
end;
if X*Y=0 then
begin
R := (A+B)/(C+D);
end;
if X*Y<0 then
begin
R := (A+B)-C+D;
end;
writeln ('Valor de R: ', R:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var A, B, C, D, R : real;
var X, Y : real;
begin
write ('Ingresa el valor de A: ');
readln (A);
write ('Ingresa el valor de B: ');
readln (B);
write ('Ingresa el valor de C: ');
readln (C);
write ('Ingresa el valor de D: ');
readln (D);
write ('Ingresa el valor de X: ');
readln (X);
write ('Ingresa el valor de Y: ');
readln (Y);
R := 0;
if X*Y>0 then
begin
R := (A*B)/(C*D);
end;
if X*Y=0 then
begin
R := (A+B)/(C+D);
end;
if X*Y<0 then
begin
R := (A+B)-C+D;
end;
writeln ('Valor de R: ', R:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.