Saturday, August 6, 2016

While Loop Statement in Pascal

In this article I would like to share with you a sample program to demonstrate how to use while loop statement in Pascal. In this sample program I am using Turbo Pascal 5.0 in DOS as my pascal compiler.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.



Sample Program Output


Program Listing


Program While_Loop;
Uses Crt;

Var A  : Integer;

Begin
  Clrscr;
  Write('While Loop Statement in Pascal');
  writeln;
  writeln;
  A := 1;
  While (A<=10) Do
   Begin
     Write(' ',A,' ');
     A := A + 1;
   End;
   Writeln;
   Writeln;
   A := 10;
   While (A>=1) Do
   Begin
     Write(' ',A,' ');
     A := A - 1;
   End;
 
  Readln;
End.


No comments:

Post a Comment