How to Display Float Value in C#

How to Display Float Value in C# . In this program we can print the floating number using the data type for the float number. Because of the high need for processing resources, float is typically employed in visual libraries. Because the range is less than that of the double type, float has shown to be the faster option when dealing with hundreds or millions of floating-point numbers.

using System;

namespace Main
class Program
static void Main(string[] args)
float myNum = 1.34F;




Float Number in C#

Numbers with a fractional part and one or more decimals are represented by floating point types. The types float and double are both acceptable. Despite the fact that C# has a large number of numeric types, the most common ones for numbers are int for whole numbers and double for floating point numbers.

System in C# Program

The using System line indicates that your project makes use of the System library. This includes classes and functions such as the Console class and the WriteLine function/method. ProjectName is a namespace that uniquely identifies and encapsulates your code within it. Namespaces are used to give your application a “named space” to live in. They’re used to give the C# compiler a context for all of your program’s named information, such as variable names.

Console.Write in C#

Console is a System namespace predefined class. The Console Class has two methods: Write() and WriteLine(). The Console is the only difference between Write() and WriteLine(). Write is used to print data without printing a new line, whereas Console is used to print a new line. Using this program we can execute print float numbers in c#.