Why it's not running?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
24th Dec 2020, 6:52 AM
Mohammad Al_Ayoubi
Mohammad Al_Ayoubi - avatar
2 Answers
+ 5
All overloads of std::pow() return a floating-type value, not an integral one. Therefore, you need to explicitly cast the result to an integral value where one is expected, i.e. in line 19 and 26. You can do it C-style or C++-style: ( int ) pow( 10, z - 1 ) or static_cast< int >( pow( 10, z - 1 ) ) Also, in line 19 you are using 'n' where I think you meant to operate on 'y' instead.
24th Dec 2020, 12:06 PM
Shadow
Shadow - avatar
+ 2
Return 0 is not necessary and i didn't use it in all of my programs and they are running well
24th Dec 2020, 6:59 AM
Mohammad Al_Ayoubi
Mohammad Al_Ayoubi - avatar