The program will print:
The sum is 6
Look at the following program. Remember the idea of sequential execution: Unless directed otherwise, a QBasic program runs by starting with the first statement and executing the statements in sequence.
' Arithmetic with Variables ' LET AGE = 23 PRINT "You have lived more than", AGE * 365, " days" END
The first statement,
LET AGE = 23
does two things:
So after this statement has executed a section of memory
named AGE
holds 23:
23 |
The first time a particular variable is used in a program, a section of main memory will be reserved for it.
Can the value in AGE
be used in a calculation?