Computer Science, asked by swapnitasinha48, 5 months ago

Write a code to print 4 to the power of 5​

Answers

Answered by madhudhanush14
1

Answer:

#include <iostream>

using namespace std;

int main()  

{

   int exponent;

   float base, result = 1;

   cout << "Enter base and exponent respectively:  ";

   cin >> base >> exponent;

   cout << base << "^" << exponent << " = ";

   while (exponent != 0) {

       result *= base;

       --exponent;

   }

   cout << result;

   

   return 0;

}

Explanation:

hope it will help you

Similar questions