Find the Complexity of the given code

Find the Complexity of the given code.

int gcd(int n, int m)
{
if (n%m ==0) return m;
if (n < m) swap(n, m);
while (m > 0)
{
n = n%m;
swap(n, m);
}
return n;
}

and this too

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++) 
                   // Print statement - O(1) operation 
              } 
        }