Correct the following QBASIC Statements:
a. Print I love QBASIC
b. 2M=36
c. Age= “Eleven”
d. Let A 20
e. 12+20= Sum
To correct the QBASIC statements, we need to make sure they follow the correct syntax and conventions of the language:
a. To correct the statement "Print I love QBASIC," we need to enclose the text within quotation marks. Moreover, the PRINT statement in QBASIC is not case-sensitive, so it can be written as 'print' or 'PRINT'. Here's the corrected version:
PRINT "I love QBASIC"
b. To correct the statement "2M=36," we need to remove the space between '2' and 'M' to have a valid variable name in QBASIC. Additionally, if you intend to assign the value of 36 to the variable '2M,' you need to use the LET keyword. Here's the corrected version:
LET 2M = 36
c. To correct the statement "Age= 'Eleven'," we need to replace the single quotation marks with double quotation marks since QBASIC uses double quotes for string values. Here's the corrected version:
Age = "Eleven"
d. To correct the statement "Let A 20," we need to add an equals sign (=) after 'A' to properly assign the value. The corrected version is:
LET A = 20
e. The statement "12+20= Sum" seems to be trying to assign the sum of 12 and 20 to a variable called 'Sum.' However, the assignment should be the other way around, with the variable on the left side. Here's the corrected version:
Sum = 12 + 20
It’s recommended to follow proper syntax and conventions to ensure the correct execution of QBASIC programs.