```
void smiley (int n) { 

 for (int i = 0; i < n * n; ++i) { 
    for (int k = 0; k < i; ++k) 
      System.out.println(”k = ” + k); 
    for (int j = n; j > 0; j--) 
      System.out.println(”j = ” + j); 
   } 
} 

```

As you can see, there are two inner loops and one outer loop. The run time for this is `n^4`. I get `n * n` makes it `n^2`, but how does the two inner loops make the total run time `n^4`?

PS

One similar case here, its run time is `n^2`. I also don't get it. It has three loops right?

```
void smiley (int n, int sum) { 
 for (int i = 0; i < n * 100; ++i) { 
    for (int j = n; j > 0; j--) 
       sum++; 
    for (int k = 0; k < i; ++k) 
       sum++; 
    } 
} 

```