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

0

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); }

c#

4/29/2021 12:05:57 PM

WhereIsAbi

4 Answers

New Answer

+2

You have semicolon after both if statements. Remove them.

+2

What if the bill is 1500?

+2

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!

0

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