Edit: Never mind, found the problem

I've been trying to make a program which will calculate the factorial of a certain number, then the number will change (+2) and it will calculate the factorial again. (This is part of the sine function)

This is the current program, but the output is merely 1. (The expected output is 1,6,120,5040…)

Edit: The new method

var icounter, ifactorial, iexponent : int

iexponent:=1

ifactorial:=1

loop

exit when ifactorial>1000000

icounter := 0

ifactorial := 1

loop

icounter := icounter + 1

ifactorial := ifactorial * icounter

exit when icounter = iexponent

end loop

put ifactorial

iexponent:=iexponent +2

end loop

This seems like it would work, but I'm not sure why it doesn't. Does the nested exit condition cause the entire loop to terminate? The new method works. Final result below

var x, xrad, pi, sinx, flag : real

var icounter, ifactorial, iexponent : int

get x

pi := 3.14159265

xrad := x * pi / 180

iexponent := 3

flag := 1

sinx:=xrad

loop

icounter := 0

ifactorial := 1

loop

icounter := icounter + 1

ifactorial := ifactorial * icounter

exit when icounter = iexponent

end loop

if flag = 1 then

sinx := sinx - (xrad ** iexponent) / ifactorial

flag := 0

else

sinx := sinx + (xrad ** iexponent) / ifactorial

flag := 1

end if

iexponent := iexponent + 2

put sinx

end loop