Thursday, March 30, 2017

While Loop Statement in Turbo Pascal

In this article I would like to share with you a sample program to demonstrate how to use while loop statement using Pascal as our programming language. I am using Turbo Pascal For Windows as my Pascal compiler in this sample program. What does the program will do is to display a series of number from 1 to 20. I hope you will learn something in this simple program that I wrote. Thank you.

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 30, 2017    Thursday            }
{Metro Manila, Philippines                  }
{jakerpomperada@yahoo.com and jakerpomperada@gmail.com }

Program while_loop;

Uses WinCrt;

Var a : Integer;

Begin
clrscr;
 a := 1;

 writeln;
 Writeln;
 writeln('WHILE LOOP STATEMENT IN PASCAL');
 writeln;
   While (a<=20) Do
     Begin
       Write(' ',a,' ');
       a := a + 1;
     End;

 writeln;
 Writeln;
 writeln('END OF PROGRAM');
readln;
End.



No comments:

Post a Comment