Write a code to print 4 to the power of 5
Answers
Answered by
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
Geography,
3 months ago
Math,
6 months ago
Math,
6 months ago
Biology,
11 months ago
Social Sciences,
11 months ago