QBASIC PROGRAM TO FIND DISTANCE TRAVELLED WHEN INITIAL VELOCITY,TIME AND ACCELERATION IS GIVEN
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
DECLARE SUB DISTANCE(U,A,T)
CLS
INPUT “ENTER INITIAL VELOCITY”; U
INPUT “ENTER TIME”; T
INPUT “ENTER ACCELARATION”; A
CALL DISTANCE(U,A,T)
END
SUB DISTANCE(U,A,T)
S = U * T + 1 / 2 * A * T ^ 2
PRINT "DISTANCE TRAVELLED = "; S
END SUB
0 Comments