Arithmatic Statements
 

The following symbols represent the arithmetic operators, ie, use them when you wish to perform calculations.

	+   Addition
- Subtraction
* Multiplication
/ Division

Addition Example
 

program Add (output);
var number1, number2, result : integer;
begin
number1 := 10;
number2 := 20;
result := number1 + number2;
writeln(number1, " plus ", number2, " is ", result )
end.

Subtraction Example
 

program Subtract (output);
var number1, number2, result : integer;
begin
number1 := 15;
number2 := 2;
result := number1 - number2;
writeln(number1, " minus ", number2, " is ", result )
end.

Multiplication Example
 

program Multiply (output);
var number1, number2, result : integer;
begin
number1 := 10;
number2 := 20;
result := number1 * number2;
writeln(number1, " multiplied by ", number2, " is ", result )
end.

Division Example
 

program Divide (output);
var number1, number2, result : integer;
begin
number1 := 20;
number2 := 10;
result := number1 / number2;
writeln(number1, " divided by ", number2, " is ", result )
end.




SELF TEST
The following program contains a few errors. Identify each error (there are seven), and show the correct version on the right.

progam TEST (output) _______________________________
var number1, number2; integer; _______________________________

begin; _______________________________

number1 = 24; _______________________________

number2 := number1 * 4; _______________________________

writeln('Help ) _______________________________

end


Answers
The following program contains a few errors. Identify each error (there are seven), and show the correct version on the right. 

progam TEST (output)
var number1, number2; integer;
begin;
number1 = 24;
number2 := number1 * 4;
writeln('Help )
end

program TEST (output);
var number1, number2 : integer;
begin
number1 := 24;
number2 := number1 * 4;
writeln('Help' )
end.

(c) Shilpa Sayura Foundation 2006-2017