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