Different Ways to Take Input and Print a Float Value in C# Last Updated : 15 Jul, 2025 Comments Improve Suggest changes Like Article Like Report In C#, we know that Console.ReadLine() method is used to read string from the standard output device. Then this value is converted into the float type if it is not string type by default. There are different methods available to convert taken input to a float value. Following methods can be used for this purpose: Single.Parse() Methodfloat.Parse() MethodConvert.ToSingle() MethodSingle.Parse() Method The Single.Parse() method is used to convert given string value to the float value. This method is consist of the following: Single is a class. Parse() is its method. Syntax: float_value = Single.Parse(Console.ReadLine()); Example: Take input of a float value using Single.Parse() Method C# // C# program to Take input // of a float value using // Single.Parse() Method using System; using System.Text; public class GFG{ // Main Method static void Main(string[] args) { //declaring a float variables float value = 0.0f; // use of Single.Parse() Method value = Single.Parse(Console.ReadLine()); //printing the value Console.WriteLine("Value = {0}", value); } } Console Input: 12.34 Output: Value = 12.34 float.Parse() Method The float.Parse() method is used to convert given string value to the float value. This method is consist of the following: float is an alias of Single class. Parse() is its method. Syntax: float_value = float.Parse(Console.ReadLine()); Example: Take input of a float value using float.Parse() Method C# // C# program to Take input // of a float value using // float.Parse() Method using System; using System.Text; public class GFG{ // Main Method static void Main(string[] args) { // declaring a float variables float value = 0.0f; // use of float.Parse() Method value = float.Parse(Console.ReadLine()); // printing the value Console.WriteLine("Value = {0}", value); } } Console Input: 12.34 Output: Value = 12.34 Convert.ToSingle() Method The Convert.ToSingle() Method is used to convert given object to the float value. This method is consist of the following: Convertis a class. ToSingle() is its method. Syntax: float_value = Convert.ToSingle(Console.ReadLine()); Example: Take input of a float value using Convert.ToSingle() Method C# // C# program to Take input // of a float value using // Convert.ToSingle() method using System; using System.Text; public class GFG{ // Main Method static void Main(string[] args) { // declaring a float variable float value = 0.0f; // use of Convert.ToSingle() Method value = Convert.ToSingle(Console.ReadLine()); // printing the value Console.WriteLine("Value = {0}", value); } } Console Input: 12.34 Output: Value = 12.34 Comment More infoAdvertise with us Next Article Program to define various types of constants in C# S shubhamsingh10 Follow Improve Article Tags : C# C# Programs Similar Reads Different ways to convert String to Integer in C# In C#, we can convert a string to an integer using various methods. This process is common when dealing with user input or data parsing. In this article, we will learn Different ways to convert String to Integer in C#.Example:Input String: "10" Output String: 10 Explanation: The input string "10" is 2 min read Program to define various types of constants in C# As in other programming languages, various types of constants are defined the same as defined in C#, we can also define various types of constants and print their values. They are fixed in values in the program. There can be any types of constants like integer, character constants, float, double, st 2 min read C# Program for Converting Hexadecimal String to Integer Given an hexadecimal number as input, we need to write a program to convert the given hexadecimal number into equivalent integer. To convert an hexadecimal string to integer, we have to use Convert.ToInt32() function to convert the values. Syntax: Convert.ToInt32(input_string, Input_base); Here, inp 2 min read Different Ways to Convert Double to Integer in C# Given a Double real number, the task is to convert it into Integer in C#. There are mainly 3 ways to convert Double to Integer as follows: Using Type CastingUsing Math.round()Using Decimal.ToInt32() Examples: Input: double = 3452.234 Output: 3452 Input: double = 98.23 Output: 98 1. Using Typecasting 2 min read Adding Text with a Float number Using String.Format() Method in C# Here the task is to add the text T with a float number F using String.Format() method. Example : Input : F = 12.3, T = "abc"Output : 12abc.abc3 Input : F = 0.0, T = "Geeks"Output : Geeks0.0Geeks The text T can be add to a float number F using String.Format() method in a following way: Add text T onl 5 min read How to set the Decimal Places in the NumericUpDown in C#? In Windows Forms, NumericUpDown control is used to provide a Windows spin box or an up-down control which displays the numeric values. Or in other words, NumericUpDown control provides an interface which moves using up and down arrow and holds some pre-defined numeric value. In NumericUpDown control 3 min read Like