Table of Contents
Overview
Below is the QBASIC program to calculate the distance traveled from initial velocity, time, and acceleration.
REM Program to calculate the distance traveled
CLS
INPUT "Enter the initial velocity: "; u
INPUT "Enter the time taken: "; t
INPUT "Enter the acceleration: "; a
S = u * t + (1/2) * a * t ^ 2
PRINT "Distance travelled is: "; S
END
Output
Explanation
Let’s first see the formula: S = u * t + (1/2) * a * t ^2. To convert distance traveled, first, ask the initial velocity (u), time taken (t), and acceleration (a) from the user and add the product of initial velocity (u) and time taken (t) with the product of acceleration (a), time (t) raised to the power of 2 and (1/2).
More Programs
https://thinkshare.one/learn/programming/qbasic/