QBasic Programming

Calculate distance.[S=UT+1/2(AT2)]

REM CALCULATE DISTANCE
CLS
INPUT “ENTER INITIAL VELOCITY”; U
INPUT “ENTER TIME”; T
INPUT “ENTER ACCELARATION”; A
S = U * T + 1 / 2 * A * T ^ 2
PRINT “DISTANCE TRAVELLED = “; S
END

USING SUB PROCEDURE

DECLARE SUB DISTANCE (U, T, A)
CLS
INPUT “ENTER INITIAL VELOCITY”; U
INPUT “ENTER TIME”; T
INPUT “ENTER ACCELARATION”; A
CALL DISTANCE (U, T, A)
END

SUB DISTANCE (U, T, A)
S = U * T + 1 / 2 * A * T ^ 2
PRINT “DISTANCE TRAVELLED = “; S
END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION DISTANCE (U, T, A)
CLS
INPUT “ENTER INITIAL VELOCITY”; U
INPUT “ENTER TIME”; T
INPUT “ENTER ACCELARATION”; A
PRINT “DISTANCE TRAVELLED = “;DISTANCE (U, T, A)
END

FUNCTION DISTANCE (U, T, A)
DISTANCE = U * T + 1 / 2 * A * T ^ 2
END FUNCTION

Input value in meter and convert into inch (Prev Lesson)
(Next Lesson) Calculate potential energy of body. [PE=MGH where G=9.8]
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 !!