Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int f(int a, int n)
- {
- if (n == 1) return a;
- else return a*f(a,n - 1);
- }
- int main()
- {
- int a,n;
- cout << "a^n \n\nUnesi a: ";
- cin >> a;
- cout << "Unesi n: ";
- cin >> n;
- cout << "REZULTAT = " << f(a, n);
- system("pause >nul");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment