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
Type the correct answer in the box. Spell all words correctly.
Pepsi [2]

Answer:

the diaphragm

hope it helps

6 0
3 years ago
Read 2 more answers
Which type of data is most sensitive and should be protected from malware?
Dennis_Churaev [7]
The correct answer is “C. The credit card number that you use to make an online purchase”
5 0
2 years ago
Two electronics technicians are looking at the piece of testing equipment shown in the figure above. Technician A says that this
Ilya [14]
B is your correct answer.
8 0
3 years ago
Read 2 more answers
Which of the following is another term for a subfolder?
LenKa [72]
Subdirectory

Have a great day! c:
5 0
3 years ago
List the six external parts or "peripherals" of a computer system and identify which are output and which are input devices/ Lis
vitfil [10]
Keyboard-Input
Mouse-Input
<u></u>Monitor-Output
Speakers-Output
Printer-Output
Hard Drive<span>-Output</span>
3 0
3 years ago
Other questions:
  • How were the pages made to create the Book of Kells? a. Scribes prepared the papers using a printing press. b. 185 calves were s
    9·1 answer
  • A software programâs _________ indicates what can legally be done with that program.]
    5·1 answer
  • "The effectiveness of memory retrieval is directly related to the similarity of cues present when the memory was encoded to the
    11·1 answer
  • Which of the following bit patterns represents the value -9 in two’s complement notation?
    15·1 answer
  • A half-life is the amount of time it takes for a substance or entity to fall to half its original value. Caffeine has a half-lif
    12·1 answer
  • A host is on the 192.168.146.0 network that has a subnet mask of 255.255.255.0. The binary value of the host portion is 11010101
    8·1 answer
  • In which situation would saving a Word document as a PDF be most useful?
    9·2 answers
  • with the advent of technology one can experience special features such as 3D theater experiences true or false
    8·1 answer
  • Why Use LinkedIn AI Automation Tools to Grow Your Sales Pipeline?
    7·1 answer
  • Uhaul general mechanical questions 2021
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!