Sunteți pe pagina 1din 2

FAT0015 Fundamental of Programming I

Week 5 Lab 2

Week 5, Lab 2
Learning Outcomes
Upon completion of this lab session, learners will be able to:
1. identify the components and tokens of a simple Pascal program,
2. compile and run a basic Pascal program, and
3. apply all the steps in Software Development Methods.

Keywords
Pascal Program, Pascal tokens ~ variable, identifier, keyword, input, output,
compile, run, syntax error

Activity #1
Label all elements in the PASCAL program below.

Line
Label
number
1
2,3
4,5,&6
7
8&9
10&11
12
13
14
By using a text editor of a PASCAL compiler package, type the program and save
it as welcome_xxxxxx.pas into your own directory (student ID) where xxxxxx is
your ID. Now, compile the program. If you have some syntax errors, try to correct
the errors and re-compile. Repeat this process until your program has no syntax
error.
Follow the following instructions and answer the questions:
Run the program. Can you see the output?
At line 13, use the statement write instead of writeln
What is your output?
What is the difference between write and writeln ?
Page 1 of 2

FAT0015 Fundamental of Programming I

Week 5 Lab 2

Activity #2
Write a computer program that calculates the surface area of a cylinder based
on radius and height entered by the end user.

A=2rh+22
Deliverable items:
1. Analysis
2. Pseudo-code OR Flowchart; Desk-Check
3. Pascal Program
4. Two sets of output from the program runs.
NOTE:
Use sequential structure only.
Assume that the users will enter a number greater than 0.
Submit your solutions for Activity #2 ONLY.

Page 2 of 2

S-ar putea să vă placă și