The compiler gives an error CS0030: Cannot convert type 'void' to 'double'. Help me please. The code here:
static public double Decode(string a)
{
double c=double.Parse(a);
return (double)Console.WriteLine(c%3);
}
Modify your function and use it like in example below.
using System;
public class Program
{
public static double Decode(string a)
{
return double.Parse(a);
}
public static void Main()
{
var decoded = Decode("2.1");
Console.WriteLine(decoded);
}
}
OUTPUT: 2.1
If you want improve this function read about Double.TryParse.