Question Types:
Find the power of any give integer value using c++ programming language ?
C++ program code for to calculate a to the power b without using power function ?
Program Code:
#include<iostream>
using namespace std;
int main()
{
double num , pow ,x =1;
cout<<"Enter any integer value : ";
cin>>num;
cout<<"Enter power of that number : ";
cin>>pow;
for(int i = 0; i<pow ;i++)
{
x = x * num;
}
cout<<"\n\nAnswer is : "<<x;
cout<<"\n>>> informativei.blogspot.com";
return 0;
}
No comments:
Post a Comment