
program Teste {

Declarations

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


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


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

	  Statements

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

		return m;
	}


Statements

	for (a in 0..3) stepUp 1
	{
		array3[a] = factorial(a+1);
	}

	writeLn(array3);
	array2 = calculate(array1); 
	writeLn(array2);
}


