0

How to obtain a power of any number using c++ programming?

29th Oct 2016, 3:11 PM
pankaj
pankaj - avatar
7 odpowiedzi
+ 2
there are two ways first is using pow function of header file math. second is by loop i. e., int p,n; cout<<"enter no and it's power"; cin>>n>>p; for(int i=0;i<p;i++) { n*=n; } cout <<n;
29th Oct 2016, 6:14 PM
Ayush jain
Ayush jain - avatar
0
for square of a number...check out this program....Analyze it..http://www.sololearn.com/app/cplusplus/playground/cFoOpABtPdY4/
29th Oct 2016, 3:19 PM
Random Guy
Random Guy - avatar
0
use pow exp
29th Oct 2016, 3:22 PM
●●● Kushagra ♡¿♡¿
●●● Kushagra  ♡¿♡¿ - avatar
0
thank you for help
29th Oct 2016, 3:25 PM
pankaj
pankaj - avatar
0
welcome actually it is included <math.h >header file
29th Oct 2016, 3:27 PM
●●● Kushagra ♡¿♡¿
●●● Kushagra  ♡¿♡¿ - avatar
0
ok
29th Oct 2016, 4:01 PM
pankaj
pankaj - avatar
0
adding pow function
1st Nov 2016, 1:33 PM
tabish
tabish - avatar