Now you know how to use variables and change their value. Ready for your first programming assignment?
But there's one small problem: you haven't yet learned how to display data to the screen! How are you going to know whether or not the program works if you can't see any output?
So, here's a VERY brief rundown of the next few lessons. To
display data, use:
     writeln (argument_list);
Argument list is composed of either strings or variable names
separated by commas. An example is:
     writeln ('Sum = ', sum);
Here's the programming assignment for Chapter 1:
Find the sum and average of five integers. The average should
be real. The five numbers are:
     45 7 68 2 34
Use a constant to signify the number of integers handled
by the program -- define some constant as having the
value 5.
The output should look something like this:
Number of integers = 5 Number1 = 45 Number2 = 7 Number3 = 68 Number4 = 2 Number5 = 34 Sum = 156 Average = 3.1200000000E+01
As you can see, the default output method for real numbers is scientific notation. The next section will tell you how to format it to fixed-point decimal.
To see one possible solution of the assignment, click on 'Next'.
![]() Previous lesson |
![]() To solution |
![]() Contents |
![]() Index |
![]() e-mail me |