Skip to content

Instantly share code, notes, and snippets.

@NonymousMorlock
Created December 6, 2022 13:12
Show Gist options
  • Save NonymousMorlock/a56cf1c6f58708935150b5c76d2ed676 to your computer and use it in GitHub Desktop.
Save NonymousMorlock/a56cf1c6f58708935150b5c76d2ed676 to your computer and use it in GitHub Desktop.
#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