PL/SQL block for conversion of units of length

Q. Write a PL/SQL block to convert a given number of inches into yards, feet and inches.

Answer:

3 yard = 108 inches
1 feet = 12 inches
4 inch = 4 inch

The following program is used to convert 124 inches into yards, feet and inches.

DECLARE inch int:=&howmanyinch;
yard int;
foot int;
BEGIN feet:=inch/12;
yard:=feet / 3;
foot:=feet MOD 3;
inch:=inch MOD 12;
dbms_output.put_line(yard||' '||feet||' '||inch);
END;
/


Output:

inches into yards feet

So, this output tells us that 124 inches = 3 yards 4 feet 1 inch