Showing posts with label reverse a number in turbo pascal. Show all posts
Showing posts with label reverse a number in turbo pascal. Show all posts

Saturday, August 20, 2016

Reverse a Number in Turbo Pascal

Here is a sample program that I wrote using Turbo Pascal For Windows that will ask the user to give a number and then our program will reverse the arrangement of the number.

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 Reverse_Number;
Uses WinCRT;

Var N,R : Longint;

Begin
  Clrscr;
  Write('Reverse a Number');
  writeln;
  Writeln;
  Write('Give a Number : ');
  Readln(N);
  Writeln;
  Write('===== The Result ======');
  Writeln;
  Writeln;
  Write('The Original Order : ',N);
  Writeln;
  Write('The Reverse Order  : ');
  While (N<>0) Do
    Begin
      R:= N MOD 10;
      Write(R);
      N := N Div 10;
    End;
    Readln;
  End.