-->

QBasic Statement With Programming Code - Qbasic

Today, we going to share Some Programming Code - Qbasic, Qbasic 100+ Programming Code, Free Qnasic Tutorial with Programming Codes.
QBasic Statement: A QBasic statement is a command or set of instructions to perform certain tasks. 
QBasic Statement
Some of the QBASIC statements are:

  1.CLS
   2.REM
   3.INPUT
   4.LET
   5.PRINT
   6.END
   7. PRINT USING
   8. LINE INPUT
   9. LPRINT AND LPRINT USING
   10. READ….DATA
   11. RESTORE
   12. LOCATE
   13. SWAP

The followings are QBasic statement along with their uses –
  1. CLS:
CLS command is used to clear the screen.
  1. PRINT:
It is used to print the values of variables.
Example-
CLS
X=10
PRINT "The value of X is "; X
END
The output of the given program will be
The value of X is 10


END statement:
It is used at the end of the QBASIC program to terminate it.
Syntax: END
Example-
CLS
U= 14
PRINT U
END
  1. INPUT:
It allows us to enter a value from the keyboard and assign the entered value in a variable.
Example-
CLS
INPUT "Enter the first number";x
INPUT "Enter a second number";y
S=x+y
PRINT "Sum of two numbers is "; S
END 
  1. REM
REM statement is used to write remarks or comments in the program. Remarks are added in a program only for the understanding purpose, it is not executed in the program


RESTORE Statement
Once the data element is read, it cannot be read again until the program resets it. The RESTORE statement is used to reset the data in the program.


SWAP Statement
The SWAP is an assignment statement. It exchanges the values of two variable.
 

 

1)Write a program to enter your name and print it .
CLS
Input 'Enter you name';n$
Print 'The name is';n$
End
2)Write a program to enter your name, city, country, age and print them.

CLS
Input " Enter the name ";N$
Input " Enter the city";C$
Input " Enter the country";CO$
Input " Enter the age";A
Print " The name is ";N$
Print " The city is ";C$
Print " The country is ";CO$
Print " The age is ";A
End
3)Write a program to find the area of rectangle.
Cls
Input " enter the length " ;l
Input " enter the breadth " ;b
let A = l*b
Print" the area of rectangle=" ;a
End
4)Write a program to find the area of the triangle.
Cls
Input " enter the base" ;b
Input " enter the height" ;h
let T = 1/2*b*h
Print" The area of triangle=" ;T
End
5)Write a program to find the area of the circle.
Cls
Input" Enter the radius " ;R
Let C=22/7*R^2
Print " The area of circle =" ;C
End
6)Write a program to find the circumference of the circle.
Cls
Input" Enter the radius " ;R
Let Circumference=22/7*R*2
Print " The area of circle =" ;Circumference
End

 
You May Like Also Also Like This

Post a Comment

0 Comments