Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int POTEGA(int x, int y)
- {
- int wynik=1;
- if (y == 0)
- {
- return 1;
- }
- else
- {
- for (int i = 0; i < y; i++)
- {
- wynik = wynik * x;
- }
- return wynik;
- }
- }
- int main()
- {
- cout << POTEGA(5, 4) << endl;
- cout << POTEGA(10, 2) << endl;
- cout << POTEGA(3, 1) << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement