Find the Complexity of the given snippet

Find the Complexity of the given snippet.

   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("*"); 
          } 
    } 

help me in finding this

Hey @vivekpatel
void function( int n)

{

int count = 0;

// executes n times

for ( int i=0; i<n; i++)

// executes O(n*n) times.

for ( int j=i; j< i*i; j++)

if (j%i == 0)

{

// executes j times = O(n*n) times

for ( int k=0; k<j; k++)

printf ( "*" );

}

}

Time Complexity of the above function O(n^5).

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.