JayvanGeld
New member
- Joined
- Mar 16, 2020
- Messages
- 2
- Programming Experience
- Beginner
I'm kinda new with C# in Visual Studio, and don't know why I'm having this issue. I'm trying to code a simple calculator and when I enter divide, add or subtract I have to enter it twice for the code to recognise it. Entering multiply works fine.
Code:
Console.WriteLine("Do you want to multiply, divide, add or subtract?");
if (Console.ReadLine() == "multiply")
{
Console.WriteLine("multiplying");
}
else if (Console.ReadLine() == "divide")
{
Console.WriteLine("dividing");
}
else if (Console.ReadLine() == "add")
{
Console.WriteLine("adding");
}
else if (Console.ReadLine() == "subtract")
{
Console.WriteLine("subtracting");
}
Code:
Console.WriteLine("Do you want to multiply, divide, add or subtract?");
if (Console.ReadLine() == "multiply")
{
Console.WriteLine("multiplying");
}
else if (Console.ReadLine() == "divide")
{
Console.WriteLine("dividing");
}
else if (Console.ReadLine() == "add")
{
Console.WriteLine("adding");
}
else if (Console.ReadLine() == "subtract")
{
Console.WriteLine("subtracting");
}