QBasic Programming

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

REM
CLS
DIM N(20)
FOR I = 1 TO 20
INPUT "ENTER THE NUMBERS"; N(I)
NEXT I
S = N(1)
FOR I = 2 TO 20
IF N(I) < S THEN S = N(I)
NEXT I
PRINT “THE SMALLEST NUMBER IS”; S
END

USING SUB PROCEDURE

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

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

USING FUNCTION PROCEDURE

DECLARE FUNCTION SMALL (N( ))
CLS
DIM N(20)
FOR I = 1 TO 20
INPUT "ENTER THE NUMBERS"; N(I)
NEXT I
PRINT “THE SMALLEST NUMBER IS”; SMALL (N( ))
END

FUNCTION SMALL (N( ))
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 greatest one using array (Prev Lesson)
(Next Lesson) WAP to enter any 20 numbers and display the greatest and smallest one using array
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 !!