11.
Using FUNCTION, write a
program to calculate distance travelled by a body. (Hint: s=ut+ (1/2) at2)
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
DECLARE FUNCTION D(U,T,A)
ReplyDeleteCLS
INPUT " ENTER INTIAL VELOCITY"; U
INPUT " ENTER TIME"; T
INPUT "ENTER ACCELERATION"; A
G = D(U, T, A)
PRINT "THE DISTANCE TRAVELLED BY A BODY IS"; G
END
FUNCTION D (U, T, A)
S = U * T + (1 / 2) * A * T ^ 2
D = S
END FUNCTION
I do think it can be done in this way also although your answer and mine rae same but there is a slight difference. Can you please check my answer and say if this is also correct or not . Please reply as fast as possible .
SOORY SPEELING MISTAKE ARE*
Deletemachikne bhalu
Deleteradi ko jol kera kha
Again sorry spelling mistake its are*
ReplyDeleteWrite a program to calculate and display distance travelled by a car if the initial odometer reading is 3450 and the current odometer reading is 3512.
ReplyDeleteanswer plz
DeleteCLS
DeletePRINT "Volume of a Box Calculator"
PRINT "--------------------------"
INPUT "Enter the length of the box: "; length
INPUT "Enter the width of the box: "; width
INPUT "Enter the height of the box: "; height
volume = length * width * height
PRINT "The volume of the box is: "; volume
END
CLS
DeletePRINT "Distance Traveled Calculator"
PRINT "-----------------------------"
INPUT "Enter the initial odometer reading: "; initialReading
INPUT "Enter the current odometer reading: "; currentReading
distance = currentReading - initialReading
PRINT "The distance traveled by the car is: "; distance; " miles"
END