In this post, we will learn how to convert meters to feet using the C Programming language.
To convert meters to feet, we have to multiply the length in meters by 3.28 to obtain the length in feet.
- 1 Meter = 3.25 feet
So, without further ado, let’s begin this tutorial.
C Program to Convert Meters to Feet
// C Program to Convert Meters to Feet #include <stdio.h> int main(){ float meters, feet; // Asking for input printf("Enter the length in meters: "); scanf("%f", &meters); // Conversion feet = 3.28 * meters; // Display output printf("%.2f meters = %.2f feet", meters, feet); return 0; }
Output
Enter the length in meters: 12
12.00 meters = 39.36 feet
How Does This Program Work ?
float meters, feet;
In this program, we have declared two float data type variables named meters and feet.
// Asking for input printf("Enter the length in meters: "); scanf("%f", &meters);
Then, the user is asked to enter the length in meters.
// Conversion feet = 3.28 * meters;
We convert meters into feet by multiplying the length by 3.28.
// Display output printf("%.2f meters = %.2f feet", meters, feet);
Finally, the converted length is printed on the screen using printf() function.
Conclusion
I hope after going through this post, you understand how to convert meters to feet using C Programming languages.
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: