1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Morgarella [4.7K]
3 years ago
15

On a piano, a key has a frequency, say f0. Each higher key (black or white) has a frequency of f0 * rn, where n is the distance

(number of keys) from that key, and r is 2(1/12). Given an initial key frequency, output that frequency and the next 4 higher key frequencies.
Output each floating-point value with two digits after the decimal point, which can be achieved as follows:

print('{:.2f} {:.2f} {:.2f} {:.2f} {:.2f}'.format(your_value1, your_value2, your_value3, your_value4, your_value5))

Ex: If the input is:

440
(which is the A key near the middle of a piano keyboard), the output is:

440.00 466.16 493.88 523.25 554.37
Computers and Technology
1 answer:
lesantik [10]3 years ago
8 0

Answer:

In C:

#include <stdio.h>

#include <math.h>

int main(){

   float f0,r,temp;

   r = pow(2.0,1.0/12);

   printf("f0: ");    scanf("%f", &f0);

   temp = f0;

   for(int i = 0; i<=4;i++){

       f0 = f0 * pow(r,i);

       printf("%.2lf ", f0);

       f0 = temp;    }

   return 0;

}

Explanation:

This declares f0, r and temp as float

   float f0,r,temp;

This initializes r to 2^(1/12)

   r = pow(2.0,1.0/12);

This prompts the user for f0

   printf("f0: ");    scanf("%f", &f0);

This saves f0 in temp

   temp = f0;

This iterates the number of keys from 0 to 4

   for(int i = 0; i<=4;i++){

This calculates each key

       f0 = f0 * pow(r,i);

This prints the key

       printf("%.2lf ", f0);

This gets the initial value of f0

       f0 = temp;    }

   return 0;

You might be interested in
What is the output of the following C++ code? int list[5] = {0, 5, 10, 15, 20}; int j; for (j = 0; j &lt; 5; j++) cout &lt;&lt;
sesenic [268]

Answer:

what?

Explanation:

8 0
3 years ago
What is a propriety database
Alexxandr [17]
A proprietary database is a database that is not open to the public and has a password and is owned privately
3 0
4 years ago
Pls help.
melisa1 [442]

Answer:

First one would be work ethic.

Second one would be communication.

Third one would be adaptability.

Fourth one would be creativity.

(These are all guesses tho, so i'm not 100% sure !!)

Explanation:

6 0
3 years ago
Read 2 more answers
_______ imaging technology defines locations in the brain where neurons are especially active using safe radioactive isotopes to
Radda [10]

Answer:

Positron Emission Tomography (PET)

Explanation:

4 0
3 years ago
Read 2 more answers
Heather writes an essay for language arts and receives a poor grade. To figure out why she gets a poor grade, Heather looks at t
Kazeer [188]

Answer:

Glows and grows strat

Explanation:

4 0
3 years ago
Read 2 more answers
Other questions:
  • Largest operating expenses include
    7·1 answer
  • One example of a Microsoft Store app is Select one: a. Photos. b. Paint. c. File Explorer. d. Notepad.
    10·1 answer
  • A ________ refers to specific content of a field.
    7·1 answer
  • Project: Math Tutor Program with Error Handling
    9·2 answers
  • I need help ASAP please and thank you!
    11·1 answer
  • A network administrator determines who may access network resources by assigning users
    10·1 answer
  • Choose a topic related to a career that interests you and think about how you would research that topic on the Internet. Set a t
    14·1 answer
  • How todraw a status bar​
    9·1 answer
  • HELPPPPP Which tag used to add a new line:<br> A. ol<br> B. P<br> C. h1<br> D li
    7·1 answer
  • Which of the following is not a valid Java identifier? a. Factorial, b. anExtremelyLongldentifierlfYouAskMe, c. 2ndLevel, d. Iev
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!