Saturday, October 28, 2017

Addition of Two Numbers Using Function in Turbo Pascal

A very simple program that I wrote that will ask the user to give two numbers and then our program will compute the sum of the two numbers using function in Turbo Pascal.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.


Program Listing

Program Addition;
Uses Crt;

Var A,B  : Integer;
    Ch   : Char;

Function Add(Var C,D : Integer) : integer;
Begin
 Add := C + D;
End;

Begin
 Repeat
 Clrscr;
 Write('Enter the First Value :');
 Readln(A);
 Write('Enter the First Value :');
 Readln(B);
 Writeln;
 Write('The sum of two values is',' ',Add(A,B));
 Writeln;
 Writeln;
 Repeat
 Write('Do You Want To Continue y/n ? ');
 Ch := Upcase(Readkey);
 Until Ch in ['Y','N'];
 Clrscr;
 Until Ch = 'N';
 Exit;
 Readln;
End.



No comments:

Post a Comment