I'm having a problem with my Visual Studio with C#. I'm creating console applications using .NET 5.0 (current).
Whenever I compile my program and put in decimal numbers (example: 62.5 it saves it as 625). How do I fix this?
Here's the code I've been using (it also does not save the commas on every other program). This program chooses the biggest number of the 3 inputs
using System;
namespace OEFGREATEST
{
class Program
{
static void Main(string[] args)
{
string input_1_b;
string input_2_b;
string input_3_b;
decimal input_1;
decimal input_2;
decimal input_3;
input_1_b = Console.ReadLine();
input_2_b = Console.ReadLine();
input_3_b = Console.ReadLine();
input_1 = Convert.ToDecimal(input_1_b);
input_2 = Convert.ToDecimal(input_2_b);
input_3 = Convert.ToDecimal(input_3_b);
decimal output_1 = Math.Max(input_1, input_2);
decimal output_2 = Math.Max(output_1, input_3);
Console.WriteLine(output_2);
}
}
}
I've been using an online compiler while using the exact same program and it saves decimal numbers as normal (ex. 62.5 saves as 62.5)
Here are pictures of the compilers:
The online compiler (works fine)
Compiler Visual Studio (does not work fine)
Does anyone know how I can fix this? I've already reinstalled Visual Studio but it didn't fix it.