Computer Studies
 Knot Making

Variables in programming

  • A variable is a place in the ram where we put a value.
  • Values can be made up of numbers, text or other types.
  • The advantage with variables is that we can change the values while the program is running.
  • To use variables we must first define them at the top of the program
  • Then we can assign a value to them or leave them blank
  • This is a simple code:
    • Input “What is your name?”, name$
    • Print name$
  • The INPUT command waits for the user to key in the input
  • The words inside the “” wil be displayed as instructions
  • The name$ is the text variable name we will use.
  • This is a more advanced code:
    • Input “What is your name?”, name$
    • Input “What is your age?”, age
    • Print name$ age

  • A simple Calculator program:
    • Input “First number”, numb1
    • Input “Second number”, numb2
    • Print numb1*numb2
  • A joke:
    • Input “What is your name?”, name$
    • Input “Tell me your age”, age
    • Print “Dear ”; name$; “ you still have ” 75-age; “ to live”

REM this is my program
PRINT "Appleworld"
PRINT 3 + 4


  • Start qbasic from pen drive and create the programs shown above
  • Think of different programs that use the variables.
    • Ex: program that ask you for your name and surname and age, then displays everything.
    • Program that ask for your mark (out of 10 for ex) and then displays a percentage

play free sudoku online

Quick links:
Home - Free vectors - pet health care - free stained glass patterns - Free Cross stitch - Free coloring pages - Colorful stained glass patterns for free - Eggart by Candice - Top Cocktail Recipes - Link to us - Paid Links