-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunction.cpp
51 lines (46 loc) · 1002 Bytes
/
function.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include<iostream>
using namespace std;
int power(int a, int b){
int ans=1;
for(int i=1;i<=b;i++){
ans=ans*a;
}
return ans;
}
int main(){
// int a,b;
// cout<<"enter the two numbers"<<endl;
// cin>>a>>b;
// int answer=1;
// for (int i = 1; i <=b; i++)
// {
// answer= answer*a;
// }
// cout<<"answer is :"<<answer<<endl;
// int c,d;
// cout<<"enter the two numbers"<<endl;
// cin>>c>>d;
// answer=1;
// for (int i = 1; i <=d; i++)
// {
// answer= answer*c;
// }
// cout<<"answer is :"<<answer<<endl;
// int e,f;
// cout<<"enter the two numbers"<<endl;
// cin>>e>>f;
// answer=1;
// for (int i = 1; i <=f; i++)
// {
// answer= answer*e;
// }
// cout<<"answer is :"<<answer<<endl;
int a,b;
cin>>a>>b;
int answer =power(a,b);
cout<<"answer is:"<<answer<<endl;
int c,d;
cin>>c>>d;
answer =power(c,d);
cout<<"answer is:"<<answer<<endl;
}