diff --git a/Miscellaneous/pow.cpp b/Miscellaneous/pow.cpp new file mode 100644 index 0000000..b7f0373 --- /dev/null +++ b/Miscellaneous/pow.cpp @@ -0,0 +1,27 @@ +#include +using namespace std; +int pow(int a, int b ){ + if(a==0){ + return 0; + } + if(b==0){ + return 1; + } + int x=pow(a,b/2); + x*=x; + if(b%2){ + return x*a; + } + return x; + + +} +int main() { + int a, m; + cout<<"Enter number to find power: "; + cin>>a; + cout<<"Enter power: "; + cin>>m; + cout<