Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int a , b , r=1;
- cout << "Enter a number (a)" << endl;
- cin >> a;
- cout << "Enter its power (b)" << endl;
- cin >> b;
- while (b>0)
- {
- b=b-1;
- r=r*a;
- }
- cout << endl << "a^b = " << r;
- }
Advertisement
Add Comment
Please, Sign In to add comment