Pseudo code of d.s


What will be the value of s if N=20?

Read N
Function sample(N)
s = 0, f = 1, i=1;
Do Until i <= N
f = f * i;
s = s +(i / f);
End Do
End Function


If i and f are declared as interferes, then the statement s = s + (i/f) always yeilds 2 from 2nd iteration onwards. (i will be less than f… hence the division will be 0 in integer conversion). At the end value of a will remain 2.