C Program to Convert Feet to Meters

In this post, we will learn how to convert feet to meters using the C Programming language.

To convert the length in feet to length in meters, we have to divide the length in feet by 3.28 to get the length in meters.

  • 3.28 Feet = 1 Meters

So, without further ado, let’s begin this tutorial.

C Program to Convert Feet to Meters

// C Program to Convert Feet to Meters
#include <stdio.h>
int main(){
    float feet, meters;
    
    // Asking for input
    printf("Enter the length in feet: ");
    scanf("%f", &feet);
    
    // Conversion
    meters = feet / 3.28;
    
    // Display output
    printf("%.2f Feet = %.2f Meters", feet, meters);
    return 0;
}

Output

Enter the length in feet: 12
12.00 Feet = 3.66 Meters

How Does This Program Work ?

    float feet, meters;

In this program, we have declared two float data type variables named feet and meters.

    // Asking for input
    printf("Enter the length in feet: ");
    scanf("%f", &feet);

Then, the user is asked to enter the length in feet.

    // Conversion
    meters = feet / 3.28;

We convert the feet into meters, by dividing the length in feet by 3.28.

    // Display output
    printf("%.2f Feet = %.2f Meters", feet, meters);

Finally, the result is printed using the printf() function.

Conclusion

I hope after going through this post, you understand how to convert feet to meters using C Programming language.

If you have any doubt regarding the program, feel free to contact us in the comment section. We will be delighted to solve your query.

Also Read:

Leave a Comment

Your email address will not be published. Required fields are marked *