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
The following is not an example of a character device:_____.
melisa1 [442]

The following is not an instance of a character device:  <u>mouse sound card.</u>

<h3>What is a char machine?</h3>

Character machines are devices that do not have physically addressable storage media, such as tape purposes or serial ports, where I/O is normally served in a byte stream.

<h3>What are feeling and block devices?</h3>

The block machines access the disk using the system's normal buffering mechanism. The surface devices provide for direct communication between the disk and the user's read or write buffer.

To learn more about Character machines, refer

brainly.com/question/25280941

#SPJ4

6 0
2 years ago
A genus is a group of organisms that is very closely related.<br><br> True<br><br> False
GREYUIT [131]
True if it is biology or biotech 3/4 but if it anotomy it is false
7 0
3 years ago
Personal Web Page Generator Write a program that asks the user for his or her name, then asks the user to enter a sentence that
horsena [70]

Answer:

// Python code

username=input("Type your name: ")

desc=input("Describe yourself: ")

f=open('profile.html','w')

html="<html>\n"+\

     "<head>\n"+\

     "</head>\n"+\

     "<body>\n"+\

     "<center>\n"+\

     "<h1>"+username+"</h1>\n"+\

     "</center>\n"+\

     "<hr/>\n"+\

     desc+"\n"\

     "<hr/>\n"+\

     "</body>\n"+\

     "</html>\n"

f.write(html)

f.close()

Code for profile.html file

<html>

<head>

</head>

<body>

<center>

<h1>Jon Doe</h1>

</center>

<hr/>

A software engineer working at a startup.

<hr/>

</body>

</html>

Explanation:

  • Get the name and description of user  as an input.
  • Write HTML content by opening the file.
  • Create and develop the essential HTML syntax.
  • Write the information into the HTML file and finally close the file.
  • Write the HTML code in the profile.html file.
3 0
3 years ago
I have a question I want to ask, but it is not letting me ask it because of such phrases? I said nothing wrong in the question.
LenKa [72]

Answer:

did u put any slang like lm*o or om*g

5 0
3 years ago
How to hook your bluetooth to your computer?
natali 33 [55]
Your computer needs to have a bluetooth interface, built-in or in the form of a USB dongle. Then you need to go into a process of discovering, connecting, pairing and bonding.

This means that typically your BT device starts emitting its presence (this is called advertising), and in your BT manager software you pick this up and pair with the device. Sometimes without a "secret", sometimes by entering a passcode, depending on the device.
3 0
3 years ago
Other questions:
  • For all those among our fans and SpongeBob fans which is better SpongeBob or amount us
    11·2 answers
  • What are three requirements of information technology a. Accuracyb. _______________________________c. __________________________
    13·1 answer
  • Write a method maxMagnitude() with two integer input parameters that returns the largest magnitude value. Use the method in a pr
    10·1 answer
  • If you want a user to actively participate in an online activity, create a web ______________.
    12·2 answers
  • Which of the following could occur when both strong and weak ciphers are configured on a VPN concentrator? (Select TWO) A. An at
    5·1 answer
  • Write a Python 3 script in PyCharm that will simulate the game of "Rock, Paper, Scissors": Display a header and the simple rules
    8·1 answer
  • What is human data,
    8·1 answer
  • In a multiple-column record of a data file, ______ represent different variables and _______ represent different cases
    15·1 answer
  • The template code provided is intended to check whether an integer entered by the user is outside of the range 20-29 (inclusive)
    9·1 answer
  • Create a basic program that accomplishes the following requirements: Allows the user to input 2 number , a starting number x and
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!