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
  • 17,626
  • 12
  • 64
  • 115
Strand
  • 7
  • 3

1 Answers1

0

Use Convert class

System.Convert.ToInt32(dNumber);

please refer to Microsoft documentation enter link description here

danarj
  • 1,798
  • 7
  • 26
  • 54