mirror of
https://github.com/tiennm99/CTDL-GT.git
synced 2026-06-09 14:11:01 +00:00
26 lines
349 B
C++
26 lines
349 B
C++
#include <iostream>
|
|
using namespace std;
|
|
long pow(int n, int m)
|
|
{
|
|
if (m == 0)
|
|
{
|
|
return 1;
|
|
}
|
|
else
|
|
{
|
|
return n * pow(n, m - 1);
|
|
}
|
|
}
|
|
int main()
|
|
{
|
|
int n, m;
|
|
long p;
|
|
cout << "Nhap co so: ";
|
|
cin >> n;
|
|
cout << "Nhap so mu: ";
|
|
cin >> m;
|
|
p = pow(n, m);
|
|
cout << "n ^ m = " << p << endl;
|
|
system("pause");
|
|
return 0;
|
|
} |