Topic: Function
Write a function-‐oriented program that converts the input indeed into its equivalent centimeters. One inch is equal to 2.54 cms. Display the converted centimeters value.
note: you can choose any looping statement if needed.
using System;
using System.Collections.Generic;
using System.Globalization;
namespace App
{
class Program
{
static double convertInchCentimeters(double inch)
{
return 2.54 * inch;
}
static void Main(string[] args)
{
Console.Write("Enter inch: ");
double radius = double.Parse(Console.ReadLine());
Console.WriteLine("Centimeters : {0}", convertInchCentimeters(radius));
Console.ReadLine();
}
}
}
Comments
Leave a comment