-
Lenguaje
Pascal
-
Descripción
Realiza las 4 operaciones básicas.
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
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
program Las4OperacionesBasicas;
uses crt;
var a, b, cociente, producto, resta : real;
var suma : real;
begin
write ('Ingresa el valor de a: ');
readln (a);
write ('Ingresa el valor de b: ');
readln (b);
suma := a+b;
resta := a-b;
producto := a*b;
if b<>0 then
begin
cociente := a/b;
end
else
begin
cociente := 0;
end;
writeln ('Valor de cociente: ', cociente:0:6);
writeln ('Valor de producto: ', producto:0:6);
writeln ('Valor de resta: ', resta:0:6);
writeln ('Valor de suma: ', suma:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var a, b, cociente, producto, resta : real;
var suma : real;
begin
write ('Ingresa el valor de a: ');
readln (a);
write ('Ingresa el valor de b: ');
readln (b);
suma := a+b;
resta := a-b;
producto := a*b;
if b<>0 then
begin
cociente := a/b;
end
else
begin
cociente := 0;
end;
writeln ('Valor de cociente: ', cociente:0:6);
writeln ('Valor de producto: ', producto:0:6);
writeln ('Valor de resta: ', resta:0:6);
writeln ('Valor de suma: ', suma:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.