1 inch is equal to 2.54 centimeter, so 1 centimeter is equal to 0.3937 inches
Therefore, n centimeters are equal to (n * 0.3937)inches
and
1 foot is equal to 30.48 centimeter, therefore, 1 centimeter is equal to 0.0328 feet.
Therefore, n centimeters are equal to (n * 0.0328)feet.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 |
public static void Main() { Console.Write("Enter centimeter:"); int centimeter = Convert.ToInt32(Console.ReadLine()); double inch = 0.3937 * centimeter; double feet = 0.0328 * centimeter; Console.WriteLine("Inches is: " + inch); Console.WriteLine("Feet is: " + feet); Console.ReadLine(); } |