Friday, March 17, 2017

Square a Number in Turbo Pascal

Here in this article I would like to share with you a sample program that I wrote using Turbo Pascal for Windows to ask the user to give a number and then our program will compute the square value being provided by our user. The program uses functions in Pascal to square the number by the user given.

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


Program Square_Number;
Uses WinCrt;

var val, solve  : integer;

Function square(a : integer) : integer;
Begin
   Square := (a*a);
End;


Begin
clrscr;
 writeln('SQUARE A NUMBER IN PASCAL');
 writeln;
 Write('Give a Number : ');
 Readln(val);

 solve := square(val);

 writeln;
 write('The Square value of ' ,val, ' is ' ,solve,'.');
 writeln;
 writeln;
 writeln('  END OF PROGRAM  ');
readln;
End.



No comments:

Post a Comment