Howdy readers, today you will learn **how to write a program to convert inches to yards and feet using C++** Programming language.

This program prompts the user to enter the** length in inches**, then it converts the length into **yards and feet **using the following conversion factor:

**1 Foot = 12 Inches****1 Yard = 3 Feet**

So, without any delay, letâ€™s begin this tutorial.

**C++ Program to Convert Inches to Yards and Feet**

**C++ Program**

// C++ Program to Convert Inches to Yards and Feet #include <iostream> using namespace std; int main(){ float inches, yard, feet; // Asking for input cout << "Enter the length in inches: "; cin >> inches; // Converting inches to feet feet = inches / 12; // Converting feet to yards yard = feet / 3; // Displaying result cout << "Equivalent length in feet: " << feet << endl; cout << "Equivalent length in yards: " << yard << endl; return 0; }

**Output**

Enter the length in inches: 1200 Equivalent length in feet: 100 Equivalent length in yards: 33.3333

**Explanation**

float inches, yard, feet;

In the above example, we have declared three float data type variables named** inches**, **yard** and** feet**.

// Asking for input cout << "Enter the length in inches: "; cin >> inches;

This program prompts the user to enter the length in inches. This value gets stored in the **inches** named variable.

// Converting inches to feet feet = inches / 12;

We convert the length from inches to feet using the factor, **1 Foot = 12 inches**.

// Converting feet to yards yard = feet / 3;

Similarly, we obtain the length in yards using the factor, **1 Yard = 3 Feet**. We can also use the factor **1 Yard = 36 inches** for the conversion.

// Displaying result cout << "Equivalent length in feet: " << feet << endl; cout << "Equivalent length in yards: " << yard << endl;

At the last, the equivalent length in feet and yard is displayed on the screen using the **cout** statement. **endl** is used to insert a newline character. It is similar to the **\n** character.

**Conclusion**

I hope after reading this post, you understand **how to write a program to convert inches to yards and feet using C++** Programming language.

If you face any difficulty while understanding this program, then let us know in the comment section. We will be glad to solve your queries.