Write a Java code to input height (in inches) and convert it into feet and inches.




Source Code:-

import java.io.*;
import java.util.*;
class height
{
          height()
          {
                   int a,b,inch;
                   Scanner s=new Scanner(System.in);
                   System.out.println("Enter the Height in inches");
                   inch=s.nextInt();
                   a=inch/12;
                   b=inch%12;
                   System.out.println("The height is  "+a+" feet "+b+" inches ");
          }
          public static void main(String arg[])
          {
                   new height();
          }
}

Output :-


Comments

Popular posts from this blog

Design an AWT application to calculate the factorial of a number.

Design an AWT application to check whether the number entered in textbox is prime or not.