Untitled
unknown
plain_text
2 years ago
408 B
4
Indexable
#include <iostream> #include <algorithm> #include <vector> using namespace std; float piwpaw(float a, float b) { float h = 1.0; if (b == 0) h = 1; else if (b > 0) { for (int i = 0; i < b; i++) { h *= a; } } else if (b < 0) { for (int i = 0; i < -b; i++) { h *= a; } h = 1.0/h; } return h; } int main() { float a, b; cin >> a >> b; cout << piwpaw(a, b); }
Editor is loading...