0

How would I do exponent math with C++?

I can't figure out how to calculate exponents with C++

20th Aug 2018, 9:42 PM
TheDen106
TheDen106 - avatar
5 ответов
+ 5
Use cmath libray it find function(name is pow)to calculate expoents example: #include<iostream> #include<cmath> using namespace std; int maim(){ int x=3; int y=pow(x,2); cout<<y;//output:9
20th Aug 2018, 10:05 PM
Ammar Moulla
Ammar Moulla - avatar
+ 4
use loop example:(calculate (5)^4=625) int result,y=1; for(int i=1;i<=4;++i) y*=5; cout<<y;//output:625
20th Aug 2018, 10:23 PM
Ammar Moulla
Ammar Moulla - avatar
+ 3
welcome😇😇
20th Aug 2018, 10:28 PM
Ammar Moulla
Ammar Moulla - avatar
0
Thanks so much!
20th Aug 2018, 10:06 PM
TheDen106
TheDen106 - avatar
0
Oh, I see! Thanks.
20th Aug 2018, 10:27 PM
TheDen106
TheDen106 - avatar