VB icon

Ordinal Numbers Using Pascal

Email
Submitted on: 11/24/2015 12:08:35 PM
By: Jake R. Pomperada  
Level: Beginner
User Rating: Unrated
Compatibility: Delphi 7, Delphi 6, Delphi 5, Delphi 4, Pre Delphi 4, Kylix
Views: 3884
author picture
 
     As I learned computer programming my first programming language that I have learned is Pascal my compiler that I am using during those days in college in Turbo Pascal 5.0. In this program I would like to reminisce the past by writing a program using Pascal as my programming language to accept a number from the user and then convert the number into ordinal equivalent values. In this sample program I am using Turbo Pascal 5.5 that is widely available right now to download free from any charges over the Internet. This problem I encounter during my college day's in our programming class.

 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
!**************************************
! Name: Ordinal Numbers Using Pascal
! Description:As I learned computer programming my first programming language that I have learned is Pascal my compiler that I am using during those days in college in Turbo Pascal 5.0. In this program I would like to reminisce the past by writing a program using Pascal as my programming language to accept a number from the user and then convert the number into ordinal equivalent values.
In this sample program I am using Turbo Pascal 5.5 that is widely available right now to download free from any charges over the Internet. This problem I encounter during my college day's in our programming class. 
! By: Jake R. Pomperada
!**************************************

(* Ordinal_Numbers.pas*)
(* Written By Mr. Jake R. Pomperada, MAED-IT *)
(* Tools : Turbo Pascal 5.5. For DOS *)
(* Date : November 24, 2015 *)
Program Ordinal_Numbers;
Uses Crt;
Var number : integer;
 message : string;
 a: integer;
 mod100 : integer;
 mod10: integer;
begin
a:=0; mod10:=0; mod100:=0;
 clrscr;
 textcolor(yellow);
 write('Ordinal Number Generator in Pascal');
 writeln; writeln; writeln;
 write('Enter a Number : ');
 readln(number);
 writeln; writeln;
 for a:= 1 To number Do
Begin
 mod10 := (a mod 10);
 mod100 := (a mod 100);
if (mod10 = 1) AND (mod100 <> 11) then
 Begin
message := 'st';
 End
else if (mod10 = 2) AND (mod100 <> 12) then
 Begin
message := 'nd';
 End
else if (mod10 = 1) AND (mod100 <> 11) then
 Begin
message := 'rd';
 End
 else
Begin
 message := 'th';
End;
write(' ',a,message,' ');
End;
 writeln; writeln;
 write('End of Program');
 readln;
End.


Other 24 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.