0

Complete newbie in programming but trying to write a program where the user inputs a decimal and it gets turned in to the closest integer.

Here is my code, I'm guessing I have the conversion all wrong?

Console.WriteLine(" Write a Decimal: ");

double decimalTal = Convert.ToDouble(Console.ReadLine());
double helTal = Math.Round(decimalTal);

Console.WriteLine(helTal);
Console.ReadLine();
Filburt
  • 16,951
  • 12
  • 63
  • 111
Strand
  • 7
  • 3

1 Answers1

0

Use Convert class

System.Convert.ToInt32(dNumber);

please refer to Microsoft documentation enter link description here

danarj
  • 1,670
  • 6
  • 25
  • 51