Wednesday, October 16, 2019

40. Qbasic Program to read a number in inches and convert it into feet and inches.


40.      Write a function convert (N) to read a number in inches and convert it into feet and inches.
[1 foot = 12 inches]

DECLARE FUNCTION CONVERT(N)
CLS
INPUT "ENTER VALUE IN INCHES"; N
PRINT CONVERT(N); "FEET"; IN; "INCHES"
END
FUNCTION CONVERT (N)
SHARED IN
IN = N MOD 12
CONVERT = N \ 12
END FUNCTION

1 comment: