Here is a sample program using one dimensional array to ask the user to give five numbers and then our program will compute the total sum of the five numbers being given by our user. 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.
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..5] of Integer;
var val : List_Array;
b,sum : Integer;
Begin
clrscr;
writeln('TOTAL SUM OF VALUES 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;
Writeln;
for b := 1 to 5 Do
Begin
Write(' ',val[b],' ');
sum := sum + val[b];
End;
writeln;
writeln;
write('The total sum of values is ' ,sum,'.');
writeln;
Writeln;
writeln(' END OF PROGRAM ');
readln;
End.
No comments:
Post a Comment