Program to Convert Inches to Feet and Inches

Here you can learn program to convert inches to feet and remaining inches.

Program : Write a program in java to convert inches to feet and remaining inches.

// Program to convert inches to feet and remaining inches.
import java.util.*;
class InchesTOFeet
{
	public static void main(String ar[])
	{
		Scanner sc = new Scanner(System.in);
		int inches, feet;
		System.out.print("Enter the value of length in Inches: ");
		inches = sc.nextInt();
		feet = inches/12;
		inches = inches%12;
		System.out.println("Feet: " + feet);
		System.out.println("Inches: " + inches);
	}
}
Enter the value of length in Inches: 52
Feet: 4
Inches: 4
  1. We will declare two variable inches and feet..
  2. Take a value of the length in inches from the users and store it inches variable.
  3. We will calculate feet and remaining inches and store it feet and inches variable.
  4. After that, we will print the result of feet and remaining inches.

Be the first to comment

Leave a Reply

Your email address will not be published.


*