+ 2

Can someone explain me this bug?

I was trying to solve "Halloween Candy" but after the second case it seems like there is no input https://code.sololearn.com/cM9QvA6VN4Wz/?ref=app You can copy and paste the code in code coach to see what happens

11th Jul 2020, 11:16 PM
HadexGM
4 Antworten
+ 5
Get the result of 2/houses * 100 as a float value then round up (Ceiling()) and output that value as an integer.
12th Jul 2020, 12:18 AM
ChaoticDawg
ChaoticDawg - avatar
+ 3
You only need 2 lines of code in your Main() method. float houses = Convert.ToSingle(Console.ReadLine()); Console.WriteLine(Math.Ceiling((2/houses)*100))
12th Jul 2020, 3:48 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
Now is when I realize that I didn't understand the description of the challenge and I thought it was much more complex than it actually was. Thank you dude
17th Jul 2020, 3:59 AM
HadexGM
0
ChaoticDawg I modified the code but althought I declare float variables the code takes that result as a double
12th Jul 2020, 2:20 AM
HadexGM