C# 13.1 lesson | Sololearn: Learn to code for FREE!


C# 13.1 lesson

Dont work, why? produces two results at the same time int bill = Convert.ToInt32(Console.ReadLine()); if (bill > 1500); { Console.WriteLine(bill*0.15); } if (bill < 1500); { Console.WriteLine(bill); }


4/29/2021 12:05:57 PM


4 Answers

New Answer


You have semicolon after both if statements. Remove them.


What if the bill is 1500?


I figured out this problem! the second _if_ was superfluous, because according to the terms of the problem I need to display the value of the discount, and if the discount is not applicable, leave the half empty. CarrieForle, thank you so much for your help!


Thank you, i delete semicilon after all _if_ and 3 of 5 tests done. But 2 tests with fail too -_-