a while loop is probably better, so that it works for a = 1

also, inside the loop, you probably want to assign the things back to "a", like "a = a/2" and "a = a * 3 + 1"

Code:
int steps(int a)
{
    int count = 0;
    
    while (a > 1)
    {
      if (a%2==0)
      {
      a = a/2;
      
      }
      else
      {
       a = (a * 3) + 1;
       count++;
      }
    }
    
    return count;
}