Tutorial 3


1. Write a Pascal program to show an output below

by using control structures, i.e., while...do, repeat...until, for...to...do


2. Write a Pascal program to find a summation of the following sequence


3. Write a Pascal program to verify an integer received from a keyboard. If the integer is in a range from -3 to 3, show the output corresponding to the received integer as the table below
 

-3
GO
-2
WENT
-1
GONE
0
SEPARATE
1
DONE
2
DID
3
DO
If that integer is in the range, return to receive a new value.


4. Write a Pascal program that will receive 20 integer variables. Find the maximum and minimum values of this set of variables.


5. Write a Pascal program to find the summation of a sequence below

Hint: Use operator MOD to verify that n is odd or even number.


6. Write a Pascal program that has a function
                q(a,b) = 0  , for a < b
                          = q(a-b,b)  , for a >= b
In your program, you must receive value a and b and send these values to your function. Check your result with the following example.
                q(14,3) = 4
                q(5861,7) = 837