Showing posts with label for statement in pascal. Show all posts
Showing posts with label for statement in pascal. Show all posts

Saturday, August 6, 2016

For Loop Statement in Pascal

In this article I would like to share with you a sample program to demonstrate how to use for 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 For_Loop;
Uses Crt;

Var A  : Integer;

Begin
  Clrscr;
  Write('For Loop Statement in Pascal');
  writeln;
  writeln;
  For A := 1 to 10 Do
   Begin
     Write(' ',A,' ');
   End;
   Writeln;
   Writeln;
   For A := 10 downto 1 Do 
   Begin
     Write(' ',A,' ');
   End;
 
  Readln;
End.