Wednesday, October 16, 2019

41. Qbasic program to input any number and check whether the given no. is divisible by 3 and 7 or not


41.      Write a program to input any number and check whether the given no. is divisible by 3 and 7 or not using function procedure.

DECLARE FUNCTION CHECK$ (N)
CLS
INPUT “Enter any number”; N
PRINT “The given number is ”; CHECK$(N)
END

FUNCTION CHECK$ (N)
IF N MOD 3 = 0 AND N MOD 7 = 0 THEN
CHECK$ = “divisible by 3 and 7”
ELSE
CHECK$ = “not divisible by 3 and 7”
END IF
END FUNCTION

No comments:

Post a Comment