title: CS50 Pset3 music final calculation
body: <p>I'm trying to understand why my final calculation for the Frequency part of this Pset is not calculating properly. I'm going through the debugger, and it shows that the "steps" is counting correctly, but the calculation doesn't work.</p>
  
  <pre><code>#include &lt;cs50.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;math.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  int main(void)
  {
     string note = get_string("note:");
     {
        if (strlen(note) == 2)
        {
           int key = note[0];
           int octave = atoi(&amp;note[1]);
           int steps = 0;
  
           if(key == 'A')
              {
                 steps = (key - 65) + ((octave - 4) * 12);
              }
  
           float frequencyf = (440 * (pow(2, (steps / 12))));
           int frequency = (round(frequencyf));
           printf("%i", frequency);
        }
  
        else if (strlen(note) == 3)
        {
           int key = note[0];
           int accidental = note[1];
           int octave = atoi(&amp;note[2]);
           int steps = 0;
  
           if(accidental == '#')
             {
                 if(key == 'A')
                 {
                    steps = ((key - 65) + ((octave - 4) * 12) + 1);
                 }
              }
          else if(accidental == 'b')
              {
                 if(key == 'A')
                 {
                    steps = ((key - 65) + ((octave - 4) * 12) - 1);
                 }
              }
  
           float frequencyf = (440 * (pow(2, (steps / 12))));
           int frequency = (round(frequencyf));
           printf("%i", frequency);
        }
     }
  }
  </code></pre>