Showing posts with label while loop in pascal. Show all posts
Showing posts with label while loop in pascal. Show all posts

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.



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.