Learn Pascal Programming with Mc Kenzie Variables Computer programs are generally written to operate on data. We collect data, process the data then display the information as output. These data must be stored in the computer's memory. When we collect data we store it at specific memory locations and each memory location that holds data is given a name. Since the values in these memory locations can change we call them variables. A variable is the name a programmer gives to a memory location used to store data. |
|
Integers Integers are whole numbers such as 0, 1, 2, 3 and so on. Negative numbers such as -1, -2, -3 are also integers. Before we can use an integer variable in Pascal we must declare it. Sample program four demonstrates how three integer variables are declared and used in a program.
The century program is made up of three sections: 1. The Program Heading starts with the word PROGRAM followed by the name of the program. The name of this program is century .The heading ends with the first semi-colon. 2. The declaration section begins with Var followed by a list of three variables a, b, sum then a colon before the word INTEGER. The last character on the line is the semi-colon. 3. The body of the progarm starts with the word begin and terminates with the word end. BSS Main | Previous Lesson | Next Lesson
InfoDAM Web Technologies©MMX |