Plz explain it's time complexity

void function(int n)
{
int count = 0;

     for (int i=0; i<n; i++) 
     for (int j=i; j< i*i; j++) 
         if (j%i == 0) 
         { 
            for (int k=0; k<j; k++) 
                 printf("*"); 
          } 
    } 

??

the answer would be between theta(n^4) to bigOh(n^5)
for every i , j will take value from i to i * i
and j%i will be equal to 0 i times that is when j equals to (1 * i ,2 * i,3 * i,…i * i)
so for every i k will run (i+2i+3i+…+ii) i.e i(i+1)*i can be aproximated to be i^3
and i takes values from 1 to n (using 1 index for simplification)
so total number of operations will be (1^3 + 2^3 + 3^3 + 4^3+…+n^3) = (n^2(n+1)^2)/2
which is theta(n^4) to bigOh(n^5)

so O(n^5) should be the answer in case of mcq

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.