subject

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 by executing
cout << fixed << setprecision(2); once before all other cout statements.

Ex: If the input is:

440.0
(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
#include
#include
#include
using namespace std;

int main()
{
double fn, f0, r;
int n=4;// n being 1, 2, 3, and finally 4.
r =pow(2.0,(1.0 / 12.0));
cout << fixed < cin >> f0;
cout << f0 <<" ";
for (int i = 1; i <= n; i++)
{
//calculate
fn = f0 *pow(r , i);
cout << fn <<" ";
}
cout <
return 0;
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 05:00
Are special characters that allow you to search for multiple words at the same time.
Answers: 2
question
Computers and Technology, 22.06.2019 23:30
In my email i got a message it says a quick message and in message details on who its from its says nicole and under nicole is [email protected] -
Answers: 1
question
Computers and Technology, 23.06.2019 12:30
Animations and transitions are added from the
Answers: 1
question
Computers and Technology, 24.06.2019 13:30
Type the correct answer in the box. spell all words correctly. what is the default margin width on all four sides of a document? by default, the document has a margin on all four sides.
Answers: 1
You know the right answer?
On a piano, a key has a frequency, say f0. Each higher key (black or white) has a frequency of f0 *...
Questions
question
English, 06.04.2021 04:40
question
Mathematics, 06.04.2021 04:40
question
French, 06.04.2021 04:40
question
Mathematics, 06.04.2021 04:40