Here is a sample program that will ask the user to give two numbers and then our program will compute for it's quotient. I am using a user defined function in Turbo Pascal. I hope you will find my work useful. Thank you.
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 divide_two_numbers;
Uses Crt;
Var c,d,results : real;
Function Divide(a,b : real) : real;
begin
divide := (a/b);
end;
Begin
Clrscr;
Writeln;
textcolor(White);
Write('Divide Two Numbers in Turbo Pascal');
Writeln;
Writeln;
Write('Enter First Number : ');
Readln(c);
Writeln;
Write('Enter Second Number : ');
Readln(d);
results := Divide(c,d);
Writeln;
Writeln;
Write('The quotient of ',c:5:2, ' and ',d:5:2, ' is ' ,results:5:2, '.');
Writeln;
Writeln;
Write('End of Program');
Writeln;
Readln;
End.
No comments:
Post a Comment