+ 1

What is wrong with this code ?

I tried using this code on the Hovercraft code coach, but it keeps showing error. Please can anyone tell me what's wrong with it. My language is c#. Here's the code below. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { int Sales = 21,000,000; int Hovercrafts = Convert.ToInt32(Console.WriteLine()); int Income = Hovercrafts*3,000,000; if (Income > Sales) { Console.WriteLine("Profit"); } else if (Income == Sales) { Console.WriteLine("Broke Even"); } else if (Income < Sales) { Console.WriteLine("Loss"); } else { Console.WriteLine("No match"); } } } }

19th Apr 2020, 12:35 PM
Joseph Oritseweyinmi
Joseph Oritseweyinmi - avatar
4 Antworten
+ 1
Make sure there are no commas in the numbers, that is a strict error.
19th Apr 2020, 12:46 PM
coddy
coddy - avatar
0
quita los if despues de los else
19th Apr 2020, 2:55 PM
Angel De Leon
Angel De Leon - avatar
0
using System; namespace ConsoleApp2 { class Program { static void Main(String[] args) { int Sales = 21000000; int Hovercrafts = Convert.ToInt32(Console.Read()); int Income = Hovercrafts * 3000000; if (Income > Sales) { Console.WriteLine("Profit"); } else { if (Income == Sales) Console.WriteLine("Broke Even"); } } } }
19th Apr 2020, 3:20 PM
Angel De Leon
Angel De Leon - avatar