Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- double putere(int m, int n)
- {
- int i,c, a = 1;
- if (n == 0) return 1;
- else if (n > 0) {
- for (i = 1;i <= n;i++)
- a *= m;
- return a;
- }
- else {
- c = (-1)*n;
- for (i = 1;i <= c;i++)
- a *= m;
- return 1.0 / a;
- }
- }
- int main()
- {
- int e,b;
- cout << "b=";cin >> b;
- cout << "e=";cin >> e;
- cout << putere(b,e) << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment