This question has already been answered:

How can you write it in the form of a normal record (ie, 123 ...) and not with E + 19? My code snippet, the input number is written into a variable in this strange form, as in the picture

Console.WriteLine("enter full number"); float full = float.Parse(Console.ReadLine()); 

Marked as a duplicate by the participants 0xdb , Andrey NOP c # Mar 29 at 10:41 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • Types of formatting in .NET - Alexander Petrov
  • Console.WriteLine(x.ToString("##################################.#####################################")); - Andrey NOP

1 answer 1

so

 var full = float.Parse(Console.ReadLine)); var dec = full.ToString("F0"); 

Standard Numeric Format Strings

  • Does not work! Complains var dec = full.ToString ("D"); (System.FormatException: "Invalid format descriptor.") - Jrol 123
  • "D" works only with integers, it will be correct to "F0", provided that there is no fractional part - Andrey NOP
  • did not help, the dec variable contains 7 numbers, followed by 0 (a total of 11, as in the input!) - Jrol 123
  • Is it possible to somehow make the float write as I need? (the problem is not in the input) - Jrol 123
  • one
    @ Jrol123, do you understand that in 4 bytes it is impossible to fit a number of any arbitrary length without loss of accuracy? - Andrey NOP