09.10.2014 Views

download pascal tutorial (pdf - Tutorials Point

download pascal tutorial (pdf - Tutorials Point

download pascal tutorial (pdf - Tutorials Point

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER<br />

8<br />

Operators<br />

This section shows the operators used in a Pascal program.<br />

An operator is a symbol that tells the compiler to perform specific mathematical or<br />

logical manipulations. Pascal allows the following types of operators:<br />

<br />

<br />

<br />

<br />

<br />

<br />

Arithmetic operators<br />

Relational operators<br />

Boolean operators<br />

Bit operators<br />

Set operators<br />

String operators<br />

Let us discuss the arithmetic, relational, Boolean and bit operators one by one.<br />

Arithmetic Operators<br />

Following table shows all the arithmetic operators supported by Pascal. Assume variable A<br />

holds 10 and variable B holds 20, then:<br />

Operator Description Example<br />

+ Adds two operands A + B will give 30<br />

- Subtracts second operand from the first A - B will give -10<br />

* Multiplies both operands A * B will give 200<br />

div Divides numerator by denominator B div A will give 2<br />

mod<br />

Modulus Operator AND remainder after an<br />

integer division<br />

B mod A will give 0<br />

TUTORIALS POINT<br />

Simply Easy Learning Page 23

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!