Created
December 6, 2022 13:12
-
-
Save NonymousMorlock/a56cf1c6f58708935150b5c76d2ed676 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <iomanip> | |
using namespace std; | |
int power(int x, int y) | |
{ | |
int total = 1; | |
for (int i = 1; i <= y; i++) | |
{ | |
total *= x; | |
} | |
return total; | |
} | |
int main() | |
{ | |
int x, y; | |
cout << "Enter the base number: "; | |
cin >> x; | |
cout << "Enter the power number: "; | |
cin >> y; | |
cout << power(x, y) << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment