DIM WORD AS STRING
DIM SUM AS INTEGER
INPUT "Enter a word: ", WORD$
SUM = 0
FOR N=1 to LEN(WORD$)
SUM = SUM + ASC(MID$(WORD$,N,1))
NEXT N
PRINT "Word value: ",SUM
google is your friend. I have never used qbasic, but in about five minutes I found enough code online to do the task.
I am stuck in this question. I don't know how to proceed
The question ?
If A=1 , B=2 ,C=3 , D=4, E=5 ........................................... then print the sum of the user entered word ..
( if the user enters ABC, then the output must come :" 6 " .. (because 1 + 2 + 3 = 6)
4 answers
thank you. can u tell me how you actually found it ?
I did google searches for
qbasic input
to find how to do input and print
qbasic math
to see how math was done. It also showed the DIM statements and a FOR loop
qbasic strings
to find string functions like Val and CHR and ASC
qbasic input
to find how to do input and print
qbasic math
to see how math was done. It also showed the DIM statements and a FOR loop
qbasic strings
to find string functions like Val and CHR and ASC
wap to produce report cord of three students