Evaluate the frequency counts for all statements in the following given program segment.
for (i=1; i ≤ n; i ++)
for (j = 1; j ≤ i; j++)
for (k =1; k ≤ j; k++)
y ++;
Ans.
S1: for (i=1; i<= n; i++) S2: for (j=1; j,= i; j++)
S3 : for (k=1; k<= j; k++) S4 : y++;
Frequency counts of
S1=n
S2 = 1+ (1+2)+ (1+2+3) +....... (1+2+....n)
S3 = 1+ [ 1+ (1+2)] + .....[ 1+ (1+2) +....
(1+2+3+...n)]
S4= same as S3.