Lowest price ever! Learn Generative AI for 48% less!
Get my discount+ 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"); } } } }
3 Answers
+ 1
Make sure there are no commas in the numbers, that is a strict error.
0
quita los if despues de los else
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");
}
}
}
}