computer (q basic)
DESCRIPTION
It contains command's to execute in the Q basic.TRANSCRIPT
![Page 1: Computer (Q BASIC)](https://reader035.vdocuments.us/reader035/viewer/2022062319/555e633ed8b42a34098b45c1/html5/thumbnails/1.jpg)
UJJAL SHARMA
Computer
![Page 2: Computer (Q BASIC)](https://reader035.vdocuments.us/reader035/viewer/2022062319/555e633ed8b42a34098b45c1/html5/thumbnails/2.jpg)
UJJAL SHARMA
QBASIC• Introduction•Punctuation•Variable•Operators•Statements
![Page 3: Computer (Q BASIC)](https://reader035.vdocuments.us/reader035/viewer/2022062319/555e633ed8b42a34098b45c1/html5/thumbnails/3.jpg)
UJJAL SHARMA
INTRODUCTIONOPENING
1. Click the program of QBASIC. Where it is located in your computer.
2. Then the following window will appear. Then press ESC key to open the following window.
![Page 4: Computer (Q BASIC)](https://reader035.vdocuments.us/reader035/viewer/2022062319/555e633ed8b42a34098b45c1/html5/thumbnails/4.jpg)
UJJAL SHARMA
BASIC COMMANDS • PRINT Command: The command which display text
and numbers in the screen.
• CLS command: Helps to make clear the screen after a command is executed.
• REM command: It helps to add text or remark for the user that will not be executed.
• END command: It stops the execution of the
program.
![Page 5: Computer (Q BASIC)](https://reader035.vdocuments.us/reader035/viewer/2022062319/555e633ed8b42a34098b45c1/html5/thumbnails/5.jpg)
UJJAL SHARMA
PUNCTUATION• We will learn about the following
punctuation:
Comma Semicolon Colon
![Page 6: Computer (Q BASIC)](https://reader035.vdocuments.us/reader035/viewer/2022062319/555e633ed8b42a34098b45c1/html5/thumbnails/6.jpg)
UJJAL SHARMA
Comma(,)The comma causes the output to be displayed after leaving a gap of approximately 8-10 characters.Syntax: PRINT “text”, “text”
It will execute the following.
![Page 7: Computer (Q BASIC)](https://reader035.vdocuments.us/reader035/viewer/2022062319/555e633ed8b42a34098b45c1/html5/thumbnails/7.jpg)
UJJAL SHARMA
Semicolon(;)The semicolon causes the output to be displayed after leaving no space.Syntax: PRINT “text”; “text”
Execution will be the following
![Page 8: Computer (Q BASIC)](https://reader035.vdocuments.us/reader035/viewer/2022062319/555e633ed8b42a34098b45c1/html5/thumbnails/8.jpg)
UJJAL SHARMA
ColonThe Colon allows to write more than one statement on a single line.Syntax: PRINT “text”: Print “text”
It will Print the following
![Page 9: Computer (Q BASIC)](https://reader035.vdocuments.us/reader035/viewer/2022062319/555e633ed8b42a34098b45c1/html5/thumbnails/9.jpg)
UJJAL SHARMA
VARIABLEWe will know about the basic rules to use Variables.
A variable can be big or small, it may contain letter or numbers but the first letter should be a letter.
A variable cannot contain spaces.A special character is allowed in QBASIC
which is underscore.
![Page 10: Computer (Q BASIC)](https://reader035.vdocuments.us/reader035/viewer/2022062319/555e633ed8b42a34098b45c1/html5/thumbnails/10.jpg)
UJJAL SHARMA
OPERATORS • We will know about three types of
operators:
1. Arithmetic Operators2. Relational Operators3. Logical Operators
![Page 11: Computer (Q BASIC)](https://reader035.vdocuments.us/reader035/viewer/2022062319/555e633ed8b42a34098b45c1/html5/thumbnails/11.jpg)
UJJAL SHARMA
Arithmetic OperatorsOperation Arithmetic
SymbolExamplea = 20b = 10
Output
Addition + PRINT a + b 30
Subtraction - PRINT a - b 10
Multiplication * PRINT a * b 200
Division / PRINT a/b 2
Parenthesis ( ) PRIN a + (b*2) 40
Raising to a power ᶺ PRINT a ᶺ 2 400
![Page 12: Computer (Q BASIC)](https://reader035.vdocuments.us/reader035/viewer/2022062319/555e633ed8b42a34098b45c1/html5/thumbnails/12.jpg)
UJJAL SHARMA
Relational OperatorsOperation Relational
SymbolsExamplea = 20b = 10
Output (Will result in TRUE or FALSE)
Greater than > a > b TRUE
Greater than or equal to > = a > = b TRUE
Less than < a < b FALSE
Less than or equal to < = a < = b FALSE
Equal to = a = b FALSE
Not equal to < > a < > b TRUE
![Page 13: Computer (Q BASIC)](https://reader035.vdocuments.us/reader035/viewer/2022062319/555e633ed8b42a34098b45c1/html5/thumbnails/13.jpg)
UJJAL SHARMA
Logical OperatorsOperation Relational
SymbolsExamplea = 20b = 10c = 50
Output (Will result in TRUE or FALSE)
AND (All the conditions must be true for the final result to be true)
AND a>b and a>cHere, cond1 (a>b) is true but cond2 (a>c) is false. So the final result is false.
False
OR (Any one or all the conditions should be true for the final result to be true)
OR a>b and a>cHere, since one condition i.e. cond1 (a>b) is true, so the final result is true.
True
![Page 14: Computer (Q BASIC)](https://reader035.vdocuments.us/reader035/viewer/2022062319/555e633ed8b42a34098b45c1/html5/thumbnails/14.jpg)
UJJAL SHARMA
STATEMENT• We will know about 3 statements:
1. INPUT2. IF…THEN…ELSE3. GOTO
![Page 15: Computer (Q BASIC)](https://reader035.vdocuments.us/reader035/viewer/2022062319/555e633ed8b42a34098b45c1/html5/thumbnails/15.jpg)
UJJAL SHARMA
INPUT Statement• When a value of a variable is required to be
accepted during the execution of the program, then the INPUT command is used.
• Syntax: INPUT Variable nameExample
The output is in next slide.
![Page 16: Computer (Q BASIC)](https://reader035.vdocuments.us/reader035/viewer/2022062319/555e633ed8b42a34098b45c1/html5/thumbnails/16.jpg)
UJJAL SHARMA
• At first
• Next
• And then
![Page 17: Computer (Q BASIC)](https://reader035.vdocuments.us/reader035/viewer/2022062319/555e633ed8b42a34098b45c1/html5/thumbnails/17.jpg)
UJJAL SHARMA
IF…THEN..ELSE• This statement is used when decision-making is
required in the program.Example, REM Displaying the largest numberLET A=10LET B=20IF A>B THEN PRINT A; “is the largest number” ELSE PRINT B; “is the largest number”
![Page 18: Computer (Q BASIC)](https://reader035.vdocuments.us/reader035/viewer/2022062319/555e633ed8b42a34098b45c1/html5/thumbnails/18.jpg)
UJJAL SHARMA
GOTO Command• GOTO command is used to shift the control of
the program to the desired command. To specify where the control of the program should go, label name is specified along with the GOTO command.
• Example, Print “line #1”GOTO 10PRINT “this line is skipped”10:Output will be
Line #1
The label name is always followed by a colon
![Page 19: Computer (Q BASIC)](https://reader035.vdocuments.us/reader035/viewer/2022062319/555e633ed8b42a34098b45c1/html5/thumbnails/19.jpg)
UJJAL SHARMA
That’s All