123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
Write a C++ program to find the value of one number raised to the power of another, where number is entered by programmer.
12
Program Code: 
#include<iostream> 
using namespace std; 
int main() 
int number, i;
int power;
int result=1;
cout<<"Enter the base number : ";
cin>>number;
cout<<endl;
cout<<"Enter the  exponent : ";
cin>>power;
cout<<endl;
for( i=1;i<=power;i++) 
{
result =result * number; 
}
cout<<"Result :"<<result;
return 0;
}
The program output is tested on www.jdoodle.com
Output:
Enter the base number : 5
Enter the exponent : 3
Result :125
1234567891011121314151617181920212223
Thanks
Mukesh Rajput
Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: