QBasic Programming

WAP to enter any 20 numbers and display the greatest and smallest one using array

USING SUB PROCEDURE

DECLARE SUB GREAT ()
DECLARE SUB SMALL ()
DIM SHARED N(20)
CLS
FOR I = 1 TO 20
INPUT "ENTER THE NUMBERS"; N(I)
NEXT I
CALL GREAT
CALL SMALL
END

SUB GREAT
G = N(1)
FOR I = 2 TO 20
IF N(I) > G THEN G = N(I)
NEXT I
PRINT "GREATEST NUMBER"; G
END SUB

SUB SMALL
S = N(1)
FOR I = 2 TO 20
IF N(I) < S THEN S = N(I)
NEXT I
PRINT "SMALLEST NUMBER"; S
END SUB

USING FUNCTION PROCEDURE
DECLARE FUNCTION GREAT ()
DECLARE FUNCTION SMALL ()
DIM SHARED N(20)
CLS
FOR I = 1 TO 20
INPUT "ENTER THE NUMBERS"; N(I)
NEXT I
PRINT "GREATEST NUMBER"; GREAT
PRINT "SMALLEST NUMBER"; SMALL
END

FUNCTION GREAT
G = N(1)
FOR I = 2 TO 20
IF N(I) > G THEN G = N(I)
NEXT I
GREAT = G
END FUNCTION

FUNCTION SMALL
S = N(1)
FOR I = 2 TO 20
IF N(I) < S THEN S = N(I)
NEXT I
SMALL = S

END FUNCTION

WAP to enter any 20 numbers and display the smallest one using array (Prev Lesson)
(Next Lesson) WAP to input number and find sum of digits
Back to QBasic Programming
Notice: compact(): Undefined variable: limits in /home/bhimgautam34/public_html/wp-includes/class-wp-comment-query.php on line 853

Notice: compact(): Undefined variable: groupby in /home/bhimgautam34/public_html/wp-includes/class-wp-comment-query.php on line 853

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!