Expressions Write a console program that prompts the user for 3 double precision floating point values input1, input2, input3. Have the program compute and display the following values. the sum of input1, input2, input3 the average of input1, input2, input3 the log2 of input1 To access the built-in function log2 -- log2(X) computes the base 2 logarithm of X, you need to include the header at the top of your code.

Answers

Answer 1
Answer:

Answer:

See Explaination

Explanation:

#include <iostream>

#include <cmath>

using namespace std;

int main()

{

float input1, input2, input3;

float sum=0.0, avg, l;

cout<<"enter the value for input1: ";

cin>>input1;

cout<<"enter the value for input2: ";

cin>>input2;

cout<<"enter the value for input3: ";

cin>>input3;

sum=input1+input2+input3;

cout<<"sum of three numbers: "<<sum<<endl;

avg=sum/3;

cout<<"average of three numbers: "<<avg<<endl;

l=log2(input1);

cout<<"log2 value of input1 number: "<<l;

return 0;

}

output:

enter the value for input1: 4

enter the value for input2: 5

enter the value for input3: 6

sum of three numbers: 15

average of three numbers: 5

log2 value of input1 number: 2


Related Questions

Write a function copy that takes two arrays A and B, both of size N. The function then copies all N values from A into B and then displays it.
Your manager comes up to you and says that you need to install a vpn server so that users can work while they are doing sales calls with customers. your manager wants you to make it as secure as possible with the vpn technologies that appear in this lesson. how would you configure the server?
Gus is developing new software in an environment in which incremental changes are released at regular intervals within a timebox. Shana is developing software for the minimum viable product stage in order to provide the development team with feedback on how to improve the application. Gus is employing the software methodology known as __________, while Shana is employing the software methodology known as __________.
What is the earliest version of the present day Internet?
. How are returnspredicted in modern microprocessors?

___ defines a series of standards for encoding audio and video in digital form for storage or transmission. Most of these standards include compression, often lossy compression.a) JPEG b) ANSI c) ISO d) MPEG

Answers

Answer:

d) MPEG

Explanation:

MPEG stands for Moving Picture Experts Group.

It defines standards for audio and video compression on digital form for storage and transmission.

  • JPEG (Joint Photographic Experts Group)
  • ANSI (American National Standards Institute)
  • ISO ( International Organization for Standardization)

are also international standards but they are not related to dogotal video compression.

Question textIf operator+ is supported by a class, how many parameters should it be defined to accept?

Select one:

a. 1 or 2

b. 2

c. 3

d. 1

e. None

Answers

Answer:

b. 2

Explanation:

As we know operator + is supported by the class.Since we know that the + operator binary operator means it needs two operands to work upon it cannot work on one operand.++ operator is unary operator it works on one operand only.

For example:-

a+b

a++.

Hence we conclude that the answer is 2.

I need help please?!!!

Answers

Answer:

I can't give an answer if you don't tell me what you need help with

Explanation:

I can't give an answer if you don't tell me what you need help with

)Which of following can be thrown using the throwstatement?? Error

? Throwable

? Exception

? RuntimeException

? All of Given

? None of given

Answers

Answer:

All of Given

Explanation:

The throw keywords can be used to throw any Throwable object. The syntax is :

throw <Throwable instance>

Note that Error and Exception are subclasses of Throwable while RuntimeException is a subclass of Exception. So the hierarchy is as follows:

Throwable

-- Error

-- Exception

   -- RuntimeException

And all of these are valid throwable entities. As a result "All of Given" is the most appropriate option for this question.

Answer:

The answer is B: throwable

Explanation:

Throwable is the super class of all exceptions

(Display nonduplicate words in ascending order)Write a program that prompts the user to enter a text in one line and displays all the nonduplicate words in ascending order.
Sample Run
Enter a text: Good morning Good afternoon Good evening
Good afternoon evening morning

Answers

The programreturns uniqueelements in the string passed in with no duplicates. The programis written in python 3 thus :

text = input('Enter text : ')

#promptsuserto enterstring inputs

split_text = text.split()

#splitinputtedtext basedonwhitespace

unique = set(split_text)

#usingtheset function,takeonlyuniqueelementsin thestring

combine = ' '.join(unique)

#usethejoinfunctiontocombinethestringstoformasingle lengthstring.

print(combine)

Asamplerunoftheprogramisattached

Learn more : brainly.com/question/15086326

Answer:

The program to this question as follows:

Program:  

value = input("Input text value: ") #defining variable value and input value by user

word = value.split() #defining variable word that split value

sort_word = sorted(word) #defining variable using sorted function

unique_word = [] #defining list

for word in sort_word: #loop for matching same value

   if word not in unique_word: #checking value

       unique_word.append(word) #arrange value using append function

print(' '.join(unique_word)) #print value

Output:

Input text value: Good morning Good afternoon Good evening

Good afternoon evening morning  

Explanation:

In the above python code, a value variable is defined that uses input function to input value from the user end, and the word variable is declared, which uses the split method, which split all string values and defines the sort_word method that sorted value in ascending order.

  • Then an empty list "unique_word" is defined, which uses the for loop and inside the loop, a conditional statement is used.
  • In if block, it matches all value is unique if this is condition is true it will arrange all values and uses the print function to print all value.  

On a piano, each key has a frequency, and each subsequent key (black or white) is a known amount higher. Ex: The A key above middle C key has a frequency of 440 Hz. Each subsequent key (black or white) has a frequency of 440 * rn, where n is the number of keys from that A key, and r is 2(1/12). Given an initial frequency, output that frequency and the next 3 higher key frequencies. If the input is 440, the output is: 440 493.883 523.251 554.365.Note: Include one statement to compute r = 2(1/12) using the pow function, then use r in the formula fn = f0 * rn. (You'll have three statements using that formula, different only in the value for n).

Answers

Answer:

sample output

Enter f0 = 440

440.0,466.1637615180899, 493.8833012561241,

523.2511306011974,  554.3652619537443

Explanation:

import math                                 // math library  

def RaiseToPower():                 //  RaiseToPower method

 r = math.pow(2,1/12)               //r = 2^(1/12)

f0 = float(input('Enter f0 : '))     //input from user

                                               

//a key has a frequency,sy f0

                                                                                                                                     

print(f0,end=' ')                      //Display statement

 for n in range(1,5):                //Iterate the loop up to  the next 4 higher key Hz

n = f0 * math.pow(r,n)         //calculate the fn value

print(fn,end=' ')                   //Display statement

 RaiseToPower()                //Call RaiseToPower method