• Lenguaje

    Pascal

  • Descripción

    Se tiene un recipiente cilíndrico de radio r y altura h y una caja de ancho a, largo b y altura c. Se desea saber cuál de ellos tiene mayor capacidad de almacenamiento.

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
program CapacidadDeUnRecipienteYUnaCaja;
uses crt, math;

var a, b, c, h, r : real;
var volumen_caja, volumen_recipiente : 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 h: ');
    readln (h);
    write ('Ingresa el valor de r: ');
    readln (r);
    volumen_recipiente := PI*r*r*h;
    volumen_caja := a*b*c;
    if volumen_recipiente>volumen_caja then
        begin
            writeln ('El recipiente cil'#161'ndrico tiene mayor capacidad');
        end;
    if volumen_recipiente=volumen_caja then
        begin
            writeln ('Tienen la misma capacidad');
        end;
    if volumen_recipiente<volumen_caja then
        begin
            writeln ('La caja tiene mayor capacidad');
        end;
    writeln ('Valor de volumen caja: ', volumen_caja:0:6);
    writeln ('Valor de volumen recipiente: ', volumen_recipiente:0:6);
    writeln;
    write ('Presiona una tecla para terminar . . . ');
    readkey;
end.