Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- unsigned long function (int,int);
- int main()
- {
- int x,y;
- unsigned long z;
- cout<<"x=";
- cin>>x;
- cout<<"y=";
- cin>>y;
- z=function(x,y);
- cout<<"n"<<x<<"^"<<y<<"="<<z<<endl;
- system ("pause");
- return 0;
- }
- unsigned long function (int a,int b)
- {
- if (b==0) return 1;
- if (b==1) return a;
- else return a*function(a,b-1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement