
program Test {

Declarations

	a := 4, b:= 5, c:= 5 -> Integer;
	array1 := [10,20,30,40], array2, array3 -> array size 4;



	subProgram calculate(m -> array size 4) :: array size 4
	{
	  Declarations
		fac := 6 -> integer;

		subprogram factorial(n -> integer) :: integer
		{
		  Declarations
			res := 1 -> integer;
		  Statements
			while (n > 0)
			{
			res = res * n;
			n = n -1;
			}
		return res; 
		}

	  Statements

		for (a in 0..3) stepup 1
		{
		  m[a] = factorial(fac + a);
		}

		return m;
	}

	subProgram writeArray(z -> array size 4)
	{
	 
	  Statements
		writeLn(z);
	}


Statements

	array2 = calculate(array1); 
	writeArray(array2);
}


