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