C
C#2y ago
chief

❔ My Input of the User Isn't Staying on the Same Line

Basically my user input keeps going one line below, which throws off the symbol of input I made, as seen below My code can be found below;
namespace Calculator
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Welcome to the C# version of the calculator!");

Console.WriteLine("What would you like to do? \n1 = Addition\n2 = Subtraction\n3 = Multiplication\n4 = Division\n -> ");
int operator_choice = Convert.ToInt32(Console.ReadLine());

if (operator_choice == 1)
{
Console.WriteLine("What is your first number? \n -> ");
int firstNumber = Convert.ToInt32(Console.ReadLine());

}

}
}
}
namespace Calculator
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Welcome to the C# version of the calculator!");

Console.WriteLine("What would you like to do? \n1 = Addition\n2 = Subtraction\n3 = Multiplication\n4 = Division\n -> ");
int operator_choice = Convert.ToInt32(Console.ReadLine());

if (operator_choice == 1)
{
Console.WriteLine("What is your first number? \n -> ");
int firstNumber = Convert.ToInt32(Console.ReadLine());

}

}
}
}
4 Replies
Angius
Angius2y ago
Use Console.Write() instead
chief
chiefOP2y ago
that works thanks
JimmahDean
JimmahDean2y ago
didn't see it was answered before responding. oops.
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server