Saturday, February 27, 2016

Find the Highest and Lowest Number in Pascal Version 2

This simple program will ask the user to give five numbers and then our program will check and determine which of the five number is the highest and lowest number. I used Pascal programming language in writing this program, my compiler is Turbo Pascal 5.0 for DOS. This is the version two of my program in Pascal.

I hope you will find my work useful in learning programming in Pascal.

If you have some questions please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.



Sample Program Output

Program Listing

Program Highest_Lowest_Number;
Uses Crt;

Type
   Number_Array = Array[1..5] of Integer;

Var N : Number_Array;
    I, Highest, Lowest : Integer;

Begin
  Clrscr;

  I :=0;
  Highest := 0;
  Lowest :=0;

  Writeln('Find the Highest and Lowest Number');
  Writeln;

   For I := 1 to 5 Do
   Begin
    Write('Please Enter Item No. ',I,':');
    Readln(N[I]);
   End;

   For I := 1 to 5 Do
   Begin
     If (Highest<N[I]) Then
        Begin
          Highest := N[I];
        End;

      If (Lowest>N[I]) Then
        Begin
          Lowest := N[I];
        End;
    End;

   Writeln;
   Write('List of Numbers');
   Writeln;
   For I := 1 to 5 Do
   Begin
     Write(' ',N[I],' ');

   End;

   Writeln;
   Writeln;
   Write('Display Result');
   Writeln; Writeln;
   Writeln('The Highest Number is ',Highest,'.');
   Writeln('The Lowest Number is ',Lowest,'.');
   Writeln;
   Write('End of the Program');
   Readln;
End.

1 comment: