How I can get the value that the user inputs to round to two decimal places. I tried to use.ToString("N2") but it gave me an error of {cannot convert string to System.IFormatProvider}. I can't seem to find a solution to this error.
code is here:
using System;
using System.Text.RegularExpressions;
namespace _selfTest
{
class Program
{
public static void Main(string[] args)
{
const string formula = @"^\d+\.?\d+?\%$";
percentages(formula, Console.ReadLine());
}
public static void percentages(string bottle, string flower)
{
Regex newRegular = new Regex(bottle);
bool input = newRegular.IsMatch(flower);
if (input)
Console.WriteLine("This Percentage Is Correct! " + bottle);
else
Console.WriteLine("This Percentage Is Incorrect... " + bottle);
Console.ReadLine();
}
}
}