• Lenguaje

    Pascal

  • Descripción

    Se ingresa 3 números diferentes y determine el número medio del conjunto de los tres números (el número medio es aquel número que no es ni mayor, ni menor).

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
program MedioDe3Numeros;
uses crt;

var a, b, c, medio : 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);
    medio := 0;
    if (a>=b) and (b>=c) then
        begin
            medio := b;
        end;
    if (b>=c) and (c>=a) then
        begin
            medio := c;
        end;
    if (c>=a) and (a>=b) then
        begin
            medio := a;
        end;
    writeln ('Valor de medio: ', medio:0:6);
    writeln;
    write ('Presiona una tecla para terminar . . . ');
    readkey;
end.