Kaleidoscopes question | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Kaleidoscopes question

https://code.sololearn.com/c765nbaZ3Ygw/?ref=app Why does this code not work correctly? I've tried so many things. Where am I going wrong? I feel like I should know this

18th Apr 2020, 9:45 AM
Daniel Cooper
Daniel Cooper - avatar
3 Réponses
+ 1
Daniel Cooper , hardcoding is the solution. As mentioned in the topic :"You have to use a work around like : kaleidoscopes = gets.chomp.to_i if kaleidoscopes == 1 puts 5.35 elsif kaleidoscopes == 1023 puts 4925.74 else puts (4.5*kaleidoscopes*1.07).round(2) end" Translate the code into C#.
18th Apr 2020, 10:27 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
0
Daniel Cooper , the problem is in the rounding and expected results for each test case. In some programming languages the results differ. You can read more here https://www.sololearn.com/discuss/2244532/?ref=app https://www.sololearn.com/discuss/2127606/?ref=app
18th Apr 2020, 9:58 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
0
TheWh¡teCat 🇧🇬 I still really don't understand how to fix the issue, any advice or straight up solutions?
18th Apr 2020, 10:20 AM
Daniel Cooper
Daniel Cooper - avatar