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