Wednesday, April 15, 2020

MATH.P

[Table of Contents]
MATH.ATR Disk Image

Notes


MATH.P is a sample program from the Functions section of the Kyan Pascal 2.x User's Manual. It shows how to uses Functions in your Pascal programs.

What is on the disk?


The disk image includes the various Atari DOS 2.5 files, Kyan Pascal Include files (none of which are used in this program), Kyan Pascal Run-time library, and ...

MATH.P - Source code file
P.OUT - Kyan Pascal intermediate file
MATH - Executable file

Source Code


(* MATH.P *)
(* Kyan Pascal 2.x / Atari 8-bit *)

Program Math(Input,Output);

Var
   Length, Width, Height, Volume : Real;

Function Area(L, W : real) : Real;
Begin
   Area := L * W
End;

Begin (* Body of the main program *)
   Writeln;
   Writeln;
   Writeln;
   Writeln('This program calculates the Area');
   Writeln;
   Writeln('and Volume using values you enter.');
   Writeln;
   Writeln;
   Writeln('The length in inches is:');
   Readln(Length);
   Writeln;
   Writeln('The width in inches is:');
   Readln(Width);
   Writeln;
   Writeln('The height in inches is:');
   Readln(Height);
   Writeln;
   Writeln('The Area is ', Area(Length, Width):4:2,' square inches.');
   Volume := Height * Area(length,Width);
   Writeln;
   Writeln('The Volume is ', Volume:5:2,' cubic inches.')
End.

Sample Run





No comments:

Post a Comment