[SOLVED] Pow() function returns 0 in C++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

[SOLVED] Pow() function returns 0 in C++

When I try to "cout << pow((1/6), 1);" it prints '0'. I also tried setting precision and creating my own power function but it still returns 0.... Here is my code: https://code.sololearn.com/cA235a164a20 Thank you in advance!

2nd Aug 2021, 12:46 AM
Aleksei Radchenkov
Aleksei Radchenkov - avatar
3 Answers
+ 8
You should write 1/6 as 1.0/6
2nd Aug 2021, 1:07 AM
YUGRAJ
+ 2
Thanks a tone mate!
2nd Aug 2021, 1:17 AM
Aleksei Radchenkov
Aleksei Radchenkov - avatar
- 1
yes yes i can do
10th Aug 2021, 9:08 PM
النعيم محمد
النعيم محمد - avatar