This commit is contained in:
2024-11-26 20:35:22 +01:00
parent cbceba2519
commit 094bef3d10
4 changed files with 227 additions and 0 deletions

28
TP2/2.2.cpp Normal file
View File

@@ -0,0 +1,28 @@
#include <iostream>
using namespace std;
int pow(int base, int exp);
void main()
{
int P1, P2, P3;
P1 = pow(5, 3);
P2 = pow(7, 9);
P3 = pow(3, 21);
cout << "\nLa puissance P1 est = " << P1;
cout << "\nLa puissance P2 est = " << P2;
cout << "\nLa puissance P2 est = " << P2;
}
int pow(int base, int exp)
{
int r = 1;
while (exp-- > 0)
{
r *= base;
}
return r;
}