Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int potega(int a, int b);
- int main()
- {
- int k, a, b;
- k = potega(4, 3);
- printf("%d", k);
- getch();
- return 0;
- }
- int potega(int a, int b)
- {
- if (b == 0) return 1;
- else return a*potega(a, b-1);
- }
- //Napisz funkcje a do potegi b.
- //pot(4, 3) = 4*pot(4, 2)
- //pot(4, 2) = 4*pot(4, 1)
- //pot(4, 1) = 4*pot(4, 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement