Thursday, May 24, 2012

3. Operators in Pascal

3.1 Assignment Operator 
Used to give value to a variable. 
example: 
x: = 1 + 2; 
a: = a +1;

3.2 Arithmetic Operators  

+ 
Used to do the sums. 
example: a + b 

- 
Used to make cuts. 
example: x - 1 

* 
Used to perform multiplication. 
example: a * b 

/ 
Used to make distributions. 
example: 7/3 

div 
For integer division. 
example: 
10 div 5, will produce 2 
10 div 3, will produce 3 

mod 
Used to calculate the remaining share. 
example: 
10 mod 5, will result in 0 
10 mod 3, will produce 1

No comments:

Post a Comment