0
how can i make a code for power by for loop ??
4 Answers
+ 1
Define a variable for your Base value, the power value and the result. Set the result to your Base value.
give your FOR iterator the value of 2, the condition is that it is smaller or equal your power and iterate ithe iterator variable by 1.
In your For loop multiply the Base value on your result value. thats it.
+ 1
we do not appreciate to give you the complete solution in code. Because we want to support you on learning to solve these things by your own so here is a part of the code
int base; // set the Base like you need it
int power; // set the power like you need it
int result = base; // equal to the power of 1
for( int i = 2; i <= power; i++)
{
// multiply the base onto the result
}
// The result now contains your solution of the calculation
0
give me code plz??
0
thank you very much đđ