-
Lenguaje
Pascal
-
Descripción
Solicita 3 cifras enteras o flotantes, luego calcula el promedio de ellas, pero eliminando la menor. Ejemplo: 6 10 5, Promedio = 8.
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
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
program PromedioDe3NumerosMenosElMenor;
uses crt;
var a, b, c, menor, promedio : 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);
if a<b then
begin
menor := a;
end
else
begin
menor := b;
end;
if menor>c then
begin
menor := c;
end;
promedio := (a+b+c-menor)/2;
writeln ('Valor de menor: ', menor:0:6);
writeln ('Valor de promedio: ', promedio:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var a, b, c, menor, promedio : 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);
if a<b then
begin
menor := a;
end
else
begin
menor := b;
end;
if menor>c then
begin
menor := c;
end;
promedio := (a+b+c-menor)/2;
writeln ('Valor de menor: ', menor:0:6);
writeln ('Valor de promedio: ', promedio:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.