Pascal Tutorial for Beginners: Simple
Mathematics Operation in Pascal
In this
occasion, I am learning about how to do simple mathematic operation by using
Pascal, such as add (+), minus (-), time (x), and divide (:).
Let me
begin:
1.
Open Dev-Pascal
2.
File – New Project
3.
Console Application
4.
OK
5.
Fill the blank box below:
Project name: pMath
Unit name: Math
6.
Type this script:
program Math;
var
a,b:integer;
add,min,times,divide:real;
begin
write('Input number for A:'); read(a);
writeln;
write('Input number for B:'); read(b);
add:=a+b;
min:=a-b;
times:=a*b;
divide:=a/b;
writeln;
writeln('A+B=', add:2:0);
writeln;
writeln('A-B=', min:2:0);
writeln;
writeln('AxB=', times:2:0);
writeln;
writeln('A:B=', divide:2:0);
readln;
readln;
end.
7.
Writing of the script above, we can look at
this Figure:
8.
Save again (Ctrl+S)
9.
Run our application by pressing key F9 on
keyboard
10.
The result is:
Good luck!
***


No comments:
Post a Comment
You may comment in English or Indonesian language. It is very glad if I can visit your blog too.