finding power of a number without using power function
#include<iostream.h>
#include<conio.h>
void main()
{
int base,expo,i,sum=1;
cout<<"Enter base and exponent of the expression :";
cin>>base>>expo;
// determining the power function
for(i=0;i<expo;i++)
sum*=base;
cout<<"\nAnswer of (Base ^ exponent) :"<<sum;
//ends here
getch();
}
Output
No comments:
Post a Comment