0% found this document useful (0 votes)
35 views2 pages

Write A Program in QBASIC That Allows User To Enter Any Two Number and Display Whether Input Number Is Odd or Even by User Defined Function and Greatest Number by Suing by Sub Procedure

QBASIC program

Uploaded by

Elsing tamang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views2 pages

Write A Program in QBASIC That Allows User To Enter Any Two Number and Display Whether Input Number Is Odd or Even by User Defined Function and Greatest Number by Suing by Sub Procedure

QBASIC program

Uploaded by

Elsing tamang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Write a program in QBASIC that allows user to enter any two Write a program to check whether the input

input number is negative


number and display whether input number is odd or even by user positive or zero using sub and to find out supplied yea is leap year or
defined function and greatest number by suing by sub procedure. not by user defined function.
DECLARE SUB check (n)
DECLARE FUNCTION oddeven (a, b)
DECLARE SUB greatest (a, b) DECLARE FUNCTION leap (y)
CLS CLS
INPUT "Enter First number"; a INPUT "Enter Any number"; n
INPUT "Enter second number"; b INPUT "Enter Year"; y
PRINT oddeven(a, b) CALL check(n)
CALL greatest(a, b) PRINT leap(y)
END
END
SUB greatest (a, b)
IF a > b THEN SUB check (n)
PRINT "A is greatest number" IF n > 0 THEN
ELSE PRINT "Given number is positive"
PRINT "B is greates number" ELSEIF n < 0 THEN
END IF PRINT "Given number is Negative"
ELSE
END SUB
PRINT "Given number is odd"
FUNCTION oddeven (a, b) END IF
IF (a MOD 2 = 0 AND b MOD 2 = 0) THEN END SUB
PRINT "Given number a and b is even"
ELSEIF (a MOD 2 = 0 AND b MOD 2 <> 0) THEN FUNCTION leap (y)
PRINT "A is even number and b is odd number"
IF y MOD 4 = 0 AND y MOD 100 <> 0 OR y MOD 400 = 0 THEN
ELSEIF (a MOD 2 <> 0 AND b MOD 2 = 0) THEN
PRINT "Given year is leap year"
PRINT "A is odd number and b is even number"
ELSE ELSE
PRINT "Given numbe a and b is odd number" PRINT "Given year is not leap year"
END IF END IF
END FUNCTION END FUNCTION

You might also like