• Lenguaje

    Pascal

  • Descripción

    Se tiene un terreno A cuadrado que mide LADO metros por lado a un precio COSTOA por metro cuadrado y se tiene un terreno B rectangular que mide BASE metros de base y ALTURA metros de altura a un COSTOB por metro cuadrado. Elaborar un algorito que lea los datos de los dos terrenos e imprima cual es el más barato o si cuestan igual.

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 CostoDeTerrenos;
uses crt;

var ALTURA, BASE, COSTOA, COSTOB, LADO : real;
var terreno_A, terreno_B : real;
begin
    write ('Ingresa el valor de ALTURA: ');
    readln (ALTURA);
    write ('Ingresa el valor de BASE: ');
    readln (BASE);
    write ('Ingresa el valor de COSTOA: ');
    readln (COSTOA);
    write ('Ingresa el valor de COSTOB: ');
    readln (COSTOB);
    write ('Ingresa el valor de LADO: ');
    readln (LADO);
    terreno_A := LADO*LADO*COSTOA;
    terreno_B := BASE*ALTURA*COSTOB;
    if terreno_A<terreno_B then
        begin
            writeln ('El terrneo A es m'#160's barato.');
        end;
    if terreno_A=terreno_B then
        begin
            writeln ('Los terrenos cuestan igual.');
        end;
    if terreno_A>terreno_B then
        begin
            writeln ('El terrneo B es m'#160's barato.');
        end;
    writeln ('Valor de terreno A: ', terreno_A:0:6);
    writeln ('Valor de terreno B: ', terreno_B:0:6);
    writeln;
    write ('Presiona una tecla para terminar . . . ');
    readkey;
end.