Tech Study

C# program to Convert  Feet to Meter:

Introduction:

Feet to Meter

C# is one of the popular programing language used in developing for a wide range application, which includes desktop software, web application and game .in this article we will write about simple c# programme to convert into feet to meter.

To being, we need to understand and learn about the formula for converting feet to meter. One foot is equal 0.3048 meters. So to convert feet to meter  , we have to multiply the number of feet by 0.3048.

Here’s the C# program for feet to meter:

using System;

class FeetToMeterConverter
{
    static void Main(string[] args)
    {
        double feet, meters;

        Console.Write("Enter the length in feet: ");
        feet = Convert.ToDouble(Console.ReadLine());

        meters = feet * 0.3048;

        Console.WriteLine("{0} feet is equal to {1} meters.", feet, meters);
        Console.ReadLine();
    }
}

Let’s understand the code step by step for feet to meter:

  1. Firstly we start by importing the system namespace, which have the console class we will use to read user input and write for output to the console.
  2. We will explain about a class called feet to meter converter.
  3. We explain the main method, which is entry point for program. This method will be called when the program run.
  4. We announce two double variables: feet and meters .we will use the feet variable to store the length in feet entered by the user, and the meters variable will be stored to convert length into meters.
  5. We will convert the length in feet to meter by using the formula we discussed before and store the result in the meters variable
  6. We take help of the console. writeline method to output the converted length in meters to console, by using the sting interpolation which includes the value of the feet and meters variables in output.
  7. By using  the console. Readline method to keep the console window open for the user, until user press any key

Its done! , we have written a simple c# programme about how to convert feet to meter

 

You may also check our other Programs:

Write a C# program to sort a string array in ascending order

Write a C# program to find maximum occurring character in a string

Write a C# program to add two numbers using function

TaggedC# Program to convert feet to meter

Java Final keyword

Introduction : java final keyword The final keyword present in Java programming language is generally used for restricting the user. …

Read more

C++ Memory Management: new and delete

C++ Memory Management We know that arrays store contiguous and the same type of memory blocks, so memory is allocated …

Read more