BeginnersBook

  • Home
  • Java
    • Java OOPs
    • Java Collections
    • Java Examples
  • C
    • C Examples
  • C++
    • C++ Examples
  • DBMS
  • Computer Network
  • Python
    • Python Examples
  • More…
    • jQuery
    • Kotlin
    • WordPress
    • SEO
    • JSON
    • JSP
    • JSTL
    • Servlet
    • MongoDB
    • XML
    • Perl

Program to Convert Inches to Feet

Last Updated: September 14, 2022 by Chaitanya Singh | Filed Under: Programs

In this guide, we will see programs to convert inches to feet in various programming languages such as Java, C, C++, Python, PHP. The inches and feet are the unit of lengths.

Formula to convert Inches to Feet

feet = inches / 12

Divide the value in inches by 12 to get the length in feet unit.

Input: 120 inches
Output: 10 feet

Java Program

class JavaExample
{
  public static void main(String args[])
  {
    double inches, feet;
    inches = 120;

    //inches to feet conversion
    feet = inches/12;

    System.out.println(inches + " inches = "+feet+" feet");
  }
}

Output:

120.0 inches = 10.0 feet

C Program

// C program to convert Inches to Feet 
#include<stdio.h> 
int main() 
{ 
  double inches = 24, feet;
  feet = inches / 12; 
  printf ("%.2f inches = %.2f feet", inches, feet); 
  return 0; 
} 

Output:

24.00 inches = 2.00 feet

C++ Program

// C++ Program to Convert Inches to Feet
#include <iostream>
using namespace std;

int main(){
  double inches, feet;

  // User is asked to enter the length in inches
  cout << "Enter the length in inches: ";
  cin >> inches;

  // converting from inches to feet
  feet = inches / 12;

  // displaying length in feet
  cout << "The length in feet is: " << feet;
  return 0;
}

Output:

Enter the length in inches: 60
The length in feet is: 5

Python Program

# Python program to convert the length given in inches to feet 

inches = int(input("Enter the length in inches:"))
 
# Converting the entered length in inches to feet unit 
feet = inches / 12; 

print("The length in feet is: ",round(feet,2)) 

Output:

Enter the length in inches: 120
The length in feet is: 10.0

PHP Program

<?php 
// PHP program to convert the length given in inches to feet 
$inches = 36; 
$feet = $inches/12; 
echo("36 inches in feet is: " . $feet . "\n"); 
?>

Output:

36 inches in feet is: 3

Previous: Program to convert Inches to Centimetres

Top Related Articles:

  1. Program to Convert Kilometres (km) to Centimetres (cm)
  2. Program to Convert Inches to Centimetres
  3. Program to Convert Feet to Inches in Java, C, C++, Python & PHP

Tags: Java-Conversion

About the Author

I have 15 years of experience in the IT industry, working with renowned multinational corporations. Additionally, I have dedicated over a decade to teaching, allowing me to refine my skills in delivering information in a simple and easily understandable manner.

– Chaitanya

Copyright © 2012 – 2025 BeginnersBook . Privacy Policy . Sitemap