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
V125BC [204]
3 years ago
13

Write an efficient C++ function that takes any integer value i and returns 2^i ,as a long value. Your function should not multip

ly 2 by itself i times; there are much faster ways of computing 2^i.
Computers and Technology
1 answer:
Ilya [14]3 years ago
4 0

Answer:

long power(int i)

{

   return pow(2,i);

}

Explanation:

The above written function is in C++.It does not uses loop.It's return type is long.It uses the function pow that is present in the math library of the c++.It takes two arguments return the result as first argument raised to the power of second.

for ex:-

pow(3,2);

It means 3^2 and it will return 9.

You might be interested in
If you know the unit prices of two diffferent brands of an item,you are better able to
pantera1 [17]

Answer:

Compare the prices of the two brands.

Explanation:

Price can be defined as the amount of money that is required to be paid by a buyer (customer) to a seller (producer) in order to acquire goods and services.

In sales and marketing, pricing of products is considered to be an essential element of a business firm's marketing mix because place, promotion and product largely depends on it.

One of the importance associated with the pricing of products is that, it improves the image of a business firm.

Hence, if you know the unit prices of two different brands of an item, you are better able to compare the prices of the two brands. Subsequently, the buyer would be able to easily make a decision on which brand's product to purchase.

3 0
3 years ago
A human would do a better job determining the shortest route between twenty cities than a computer.
77julia77 [94]

Answer:

that is false I think so it true

8 0
3 years ago
Consider this program segment: int newNum = 0, temp; int num = k; // k is some predefined integer value 0 while (num > 10) {
Doss [256]

Answer:

All of these statements are true.

Explanation:

Since the while loop is reversing the integer number and leaving the highest order digit in the num and stores the reversed number in the newNum variable.

It skips one digit so if the num is in the range of [100,1000] it will result in a number between 10 and 100.

This loop can never go in infinite loop for any initial value of num because the loop will run as many times as the number of digits.

and if the value of the num is <=10 the while loop will never run and the value of newNum will be 0.

6 0
4 years ago
Were is the hype house
balandron [24]

Answer:

LA

Explanation:

where the rich people live

8 0
3 years ago
Read 2 more answers
Anyone seen by the camera, whether or not they have a speaking part or any
alekssr [168]

Answer:

my camera is also acting up too

5 0
3 years ago
Other questions:
  • Kwan is using JavaScript extensively to add interactivity to his Web site. Contained within his script is a counter object that
    8·1 answer
  • Which of the following statements about the placement of illustrations in documents is true?
    12·1 answer
  • Kelvin owns a small trading firm. Recently, he suspected that some of his employees were using fraudulent activities for their p
    5·2 answers
  • On the Loan worksheet in cell c9 enter PMT function to calculate the monthly payment for the Altamonte springs 2018 facilities l
    11·1 answer
  • Which clauses in the Software Engineering Code of Ethics are upheld by a whistleblower (check all that apply). "Respect confiden
    15·1 answer
  • What would be a standard way for anyone outside an agile team( for example, delivery partner partner of the account, head of the
    14·1 answer
  • Chegg A full bootstrap program Select one: a. may be infected by viruses. b. is stored in ROM to ensure to avoid any infection f
    13·1 answer
  • Does trend in computing important for organization management?​
    8·1 answer
  • WILL GIVE BRAINLEIST PLZ HELP PLZ AND THANK YOU
    7·1 answer
  • Which type of protocol provides a way to transfer files from one computer to another over any tcp/ip network, such as a lan or t
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!