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
PilotLPTM [1.2K]
3 years ago
10

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('%0.2f %0.2f %0.2f %0.2f %0.2f' % (your_value1, your_value2, your_value3, your_value4, your_value5))
Computers and Technology
1 answer:
Stels [109]3 years ago
3 0

Answer:

#include <stdio.h>

int main()

{

float your_value1, your_value2, your_value3, your_value4, your_value5;

printf("Enter a frequency: ");

scanf_s("%f", &your_value1);//storing initial key frequency in your value 1

 

float r = 2.0 / 12;//typing 2.0 so it is treated as float and not int

your_value2 = your_value1 * r * 1; //initial*r*n

your_value3 = your_value1 * r * 2; //initial*r*n

your_value4 = your_value1 * r * 3; //initial*r*n

your_value5 = your_value1 * r * 4; //initial*r*n

printf("%0.2f %0.2f %0.2f %0.2f %0.2f", your_value1, your_value2, your_value3, your_value4, your_value5);

return 0;

}

Explanation:

The purpose of this exercise is to make you understand the difference between float and int. float variables are used when you need decimals in your calculations. int is used when you need integers. The problem in this exercise was the formulation of r. Now r is = 2/12, this means that when we type r as that, the computer assumes that it is an integer and treats it as such. So, it will convert the 0.166667 into 0. To overcome this, all you have to do is type 2.0 instead of 2 alone.

The %0.2 command restricts the float variable to 2 decimal places. By default, it has 6 decimal places.

I have used the function scanf_s instead of scanf simply because my compiler does not work with scanf.

You might be interested in
Can someone please tell me how to divide 2 columns in Ms excel and put the values in one column.
frozen [14]
Your best bet is to research about it online or watch tutorials on YouTube for a better understanding :) <span />
7 0
4 years ago
Which type of operating system is usually used in personal computers?
joja [24]

Answer:

Microsoft Windows

Explanation:

7 0
3 years ago
Read 2 more answers
Helpppp pleaseee thanksss​
Archy [21]

Answer:

B!

Explanation:

i think... Here is an example

3 0
3 years ago
You're creating a presentation to promote a new product. If you wanted to add a square to your slide to serve as a backdrop behi
MAVERICK [17]
<h2>Answer:</h2>

<u>The correct answer is  </u><u>B. Insert Shapes</u>

<h2>Explanation:</h2>

Slides and presentations are always created in Microsoft Power Point and we know that it is the key application under the package of Microsoft Office. It gives us the option of inserting various shapes in our slides that could be used in a lot of ways depending upon the requirements. To insert shape in the slides of Microsoft Power Point we just click on the Home tab, under Insert, click Shape, point to any shape type, and then click the shape that we want.

5 0
4 years ago
Read 2 more answers
A technician looks at a motherboard and sees a 24-pin connector. What component would connect to the motherboard through the use
Firlakuza [10]
<h2>Power supply connects to the motherboard through the use of the 24 pin connector.</h2>

Explanation:

Power supply

  • is an electrical device
  • source of it come from electrical grid
  • ability to convert different form of energy (solar, mechanical & chemical) to electrical energy
  • Converts main AC voltage to low-voltage current
  • 3 types - linear voltage, switch, unregulated
  • It is also called PSU unit (Power supply unit)
  • have to protect from over current, high voltage, etc
  • Mandatory for laptop to charge and use later
4 0
3 years ago
Other questions:
  • If you turn your volume to loud on u'r headphones can it break the sound quality of the speaker?
    9·2 answers
  • Which of the following mountain ranges stretches from Alabama to Canada?
    10·1 answer
  • With the help of what memory a computer can read as well as write or modify data
    14·2 answers
  • Which of the following is a basic principle of improvement?
    13·1 answer
  • Which of the following factors will have the greatest impact on your credit score?1. Length of credit history 11. Payment histor
    7·1 answer
  • What is an appropriate action when an email thread becomes long?
    6·1 answer
  • Many company websites are now designed to do more than just sell a product. These​ websites, known as​ __________ websites, atte
    14·1 answer
  • ANY MHA FANS SAY DEKU
    6·1 answer
  • Some people worry that there won’t be enough jobs in the future because computers will be able to do everything better than peop
    7·2 answers
  • Walter is developing a website for the logistics service he offers. He wants to make the website attractive, bright, and visuall
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!