helinwasman2001
helinwasman2001 helinwasman2001
  • 20-12-2020
  • Computers and Technology
contestada

write an algorithm and draw a flowchart to calculate
2^4 using a loop approach?
​

Respuesta :

jacobEwing
jacobEwing jacobEwing
  • 20-12-2020

Answer:

I'm not about to write a flow chart for you, but here's a quick demo of how to do it:

doPower(2, 4);

function doPower(base, power){

   var result = 1, p;

   for(p = 0; p < power; p++){

       result *= base;

   }

   return result;

}

That function will only work for positive integer exponents of course.

Answer Link

Otras preguntas

KLMN with vertices K (-3,-3), L (-1,-3), M (1,4), and N (-3,1). Find the perimeter of KLMN
Read the first three paragraphs of Franklin Roosevelt's request for a declaration of war. Beyond Congress, who is his primary intended audience? the American pu
How do movies reflect on what society has to say about stereotypes? Like what do movies have to do with stereotypes?
What is the volume of this cone?
What are three examples of primary succession
In a command economy, who decides how goods and services will be produced? a Individuals only b The government c Individuals and the government d Traditions and
Question in photo pls help
How long has Brainly been on the internet?
g(n)=-50-15n(n)=−50−15n, Complete the recursive formula of g(n)
Find the area of the figure. A) 41 cm2 B) 90 cm2 C) 95 cm2 D) 100 cm2