+ 1
Paint Cost Tax [solved]
Can someone explain why I had to use tax = 0.1 in this exercise instead of using tax = 10 and then dividing the total cost * tax by a hundred? Because the second wouldn't solve for case 3 and 4... here's my code, FYI static void Main(string[] args) { int nOC = Convert.ToInt32(Console.ReadLine()); const double tax =0.1; const int pC = 5; const int pB = 40; double totC = pB + pC * nOC; double taxP = totC *tax ; double output = Math.Round (taxP+totC); Console.WriteLine(Convert.ToInt32(output)); }
2 Answers
+ 3
Each way is good if you use a double for tax.
+ 1
Ha, before, when tax was still 10, it was an int, so that was the problem. Thank you.