fork download
  1. #include<stdio.h>
  2. #include<math.h>
  3. int main()
  4. {
  5. double f;
  6. int i;
  7. char *o[12] = { "A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#" };
  8. for (i = 0; i <= 24; i++) {
  9. f = 440.0 * pow(2.0, (double) i / 12.0);
  10. printf("[%-2s] = %8.3f Hz\n", o[i % 12], f);
  11. }
  12. return 0;
  13. }
  14.  
Success #stdin #stdout 0s 2248KB
stdin
Standard input is empty
stdout
[A ] =  440.000 Hz
[A#] =  466.164 Hz
[B ] =  493.883 Hz
[C ] =  523.251 Hz
[C#] =  554.365 Hz
[D ] =  587.330 Hz
[D#] =  622.254 Hz
[E ] =  659.255 Hz
[F ] =  698.456 Hz
[F#] =  739.989 Hz
[G ] =  783.991 Hz
[G#] =  830.609 Hz
[A ] =  880.000 Hz
[A#] =  932.328 Hz
[B ] =  987.767 Hz
[C ] = 1046.502 Hz
[C#] = 1108.731 Hz
[D ] = 1174.659 Hz
[D#] = 1244.508 Hz
[E ] = 1318.510 Hz
[F ] = 1396.913 Hz
[F#] = 1479.978 Hz
[G ] = 1567.982 Hz
[G#] = 1661.219 Hz
[A ] = 1760.000 Hz