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

How could students use the historical thinking skills?
reflect the triangles across the dashed line and enter new coordinates. A (1, 4); B (4, 3); C (2, 1)
she ........ ill before important examination.1-will always be falling2- was always falling3- had always fallen4- always fell​
HEEELLLLLP PLS THIS IS DUE TODAY You have now read and listened to two speeches: one given by Martin Luther King and one given by George W. Bush. Describe each
9 thousands = how many hundreds
write a paragraph about the French revolution
what is the terms in this expression, 5 - 4x - 8
Let ax-by=c, where a,b,c>0. Rewrite the equation in slope-intercept form
i need help i will mark brainlest
x+[tex]\sqrt{x}[/tex]+1 / [tex]\sqrt[3]{x}[/tex]