In this tutorial, I have decided to create a simple centimeter to inch calculator program in C# Console.
First one we have to know how to convert cm to inch .
1cm=0.39370 inc
here are the cm to inc program codes;
1 2 3 4 5 6 7 8 9 10 11 12 | static void Main(string[] args) { double inc; Console.Write("Input Value (cm) : "); double cm = Convert.ToDouble(Console.ReadLine()); inc = cm * 0.39370; //approximately Console.WriteLine("{0} centimeters : {1} inches", cm, inc); Console.ReadKey(); } |
Output: