Showing posts with label three numbers in pascal. Show all posts
Showing posts with label three numbers in pascal. Show all posts

Friday, March 17, 2017

Sum of Three Numbers in Pascal

In this article I would like to share with you a sample program that I wrote using Pascal as my programming language that will ask the user to give three numbers and then our program will compute the total sum of three numbers using functions in Pascal. The compiler that I am using in this sample program is Turbo Pascal For Windows. The code is very simple and easy to understand.

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

var val_1,val_2,val_3, add : integer;

Function sum(a,b,c : integer) : integer;
Begin
   sum := (a+b+c);
End;


Begin
clrscr;
 writeln('SUM OF THREE NUMBERS IN PASCAL');
 writeln;
 Write('Enter First Number : ');
 Readln(val_1);

 Write('Enter Second Number : ');
 Readln(val_2);

 Write('Enter Third Number  : ');
 Readln(val_3);
   
 add := sum(val_1,val_2,val_3);

 writeln;
 write('The sum of ',val_1,' ',val_2, ' and ',val_3, ' is ' ,add,'.');
 writeln;
 writeln;
 writeln('  END OF PROGRAM  ');
readln;
End.