Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- float putere(int a, int n) {
- if (n > 0) {
- return a * putere(a, n - 1);
- }
- if (n < 0) {
- return 1 / putere(a, -n);
- }
- return 1;
- }
- int main() {
- int a, n;
- cin >> a >> n;
- cout << putere(a, n) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement