Showing posts with label one dimensional array in pascal. Show all posts
Showing posts with label one dimensional array in pascal. Show all posts

Sunday, March 19, 2017

One Dimensional Array in Turbo Pascal

In this article I would like to share with you a sample program that will demonstrate how to use one dimensional array using Pascal as our programming language. What does the program will do is to ask the user to give five numbers and then our program will display the list of five numbers given by our user. The code is very simple and easy to understand. I am using Turbo Pascal for Windows as my pascal compiler in this sample program.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.





Sample Program Output


Program Listing

{Written By: Mr. Jake R. Pomperada, MAED-IT }
{Date : March 19, 2017    Sunday            }
{Metro Manila, Philippines                  }
{jakerpomperada@yahoo.com and jakerpomperada@gmail.com }

Program One_Dimensional;
Uses WinCrt;

Type

List_Array = Array[1..6] of Integer;

var val : List_Array;

    b   : Integer;

Begin
clrscr;
 writeln('ONE DIMENSIONAL IN PASCAL');
 writeln;
 for b := 1 to 5 Do
  Begin
     Write('Give value in item no. ' ,b, ' : ');
     Readln(val[b]);
  End;
 Writeln;
 Write('List of Given Values');
 Writeln;
   for b := 1 to 5 Do
  Begin
    Write(' ',val[b],' ');
  End;
 writeln;
 Writeln;
 writeln('  END OF PROGRAM  ');
readln;
End.