0
How to write a program in which power is used with using loops only?
Example 2^4, 5^6 etc
1 ответ
+ 6
The answer can be easily found by googling.
In case you are having problem in understanding those programs :
[Name :Power. ]
step 1:input exponent , number.
step 2:initialize result = 1 , i=1
step 3:Repeat step 4
while i<=exponent
step 4:
A) result= number *result
B) i=i+1
step 5:display result.
step 6:stop
How it'll work
Input exponent =4
number =4
Loop will repeat step :
result = result * number
result =1
result =1*4. //4
result =4*4. //16
result =16*4. //64
result =64*4. //256
Display result.
now you can do this with any language.
just need to understand loops and variables.