What will be the frequency count of this code snippet?

int i=0,j;

while(i<=n)
{
while(j<=(i+1)){
a=a*a;
j++;
}
i++;


This question was in my homework and we have to calculate the frequency count of the code above. I am having difficulty understanding how the code will execute and how many times will the loops execute. I know the inner loop is dependent on 'i', otherwise I'm lost.

• Do you reset $j$ before the second while loop? If not, then the second loop will take only one operation, since $j$ would already be incremented a big nch of times – nir shahar Mar 26 at 11:24
• Is this typed exactly as its written, or are there possibly some errors in typing it? – awillia91 Mar 27 at 13:40
• This how to question was given to me in my homework. I made no changes – Brishti Basu Mar 28 at 18:55