#include<iostream.h> float powerec(float b, float r) { if(r==0) return 1; else return(b*powerec(b,r-1)); } void main() { float b,r; b=0; r=0; cout<<"\nEnter The Base: "; cin>>b; cout<<"\nEnter The Power: "; cin>>r; float res=powerec(b,r); cout<<"\nThe Result Is: "<<res; }
Showing posts with label recursion. Show all posts
Showing posts with label recursion. Show all posts
Sunday, May 18, 2014
X to the power of Y using recursion in C ++
Labels:
c plus plus,
cpp program,
data structures,
recursion,
x to the power y
Subscribe to:
Posts (Atom)