Saturday, August 27, 2016

Inches To Centimeter in Turbo Pascal

A simple program that I wrote using Turbo Pascal to ask the user to give a value in inches and then it will convert it to centimeter equivalent.  The code is very simple and easy to understand.

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 Inch_To_Cm;
Uses WinCrt;

Var
  Choice : Char;
  inch   : Integer;

Procedure inchtocm(var inch : integer);
Var
  Cm : real;
Begin
 cm := inch * 2.54;
 writeln(inch, ' inch is equal to ',cm:5:2,' cm');
End;

Begin
  Clrscr;
  Choice := 'Y';
  Write('Inch To Centimeter Converter');
  Writeln;
  Writeln;
  While upcase(Choice) = 'Y' Do
    Begin
     Writeln;
     Write('Give the value in inch : ');
     Readln(inch);
     Writeln;
     inchtocm(inch);
     Write('Continue [Y/N] ');
     readln(choice);
     Writeln;
    End;
    Writeln;
    Write('End of Program');
    Writeln;
  Readln;
End.



No comments:

Post a Comment