You are on page 1of 6

Laboratory Exercise No 1

Algorithms and Flowcharting

1. Objective(s):
The activity aims to introduce the basic concept of algorithm and flowcharting.

2. Intended Learning Outcomes (ILOs):


At the end of the laboratory exercise, the students should be able to:

2.1. Create an algorithm in solving computer problems.


2.2. Design a flowchart to test the validity of the created algorithms.
3. Discussion (not more than 300 words):

Algorithm is a set of instructions for carrying out some processes step by step. It is a set of
instructions that specify an arrangement of operations to be carried out in order to solve a particular
problem or class of problems. Algorithm is a detailed sequence of steps that is needed to solve a certain
problem.

Flowchart is a visual representation of an algorithm. It is also a diagram representing the logical


sequence in which a combination of steps or operations is to be performed. Flowchart use symbols and
phrases to designate the logic of how a problem is solved.

4. Resources:
N/A

5. Procedure:

1. Create an algorithm and flowchart to accept twenty(20) numbers that will:

 determine whether the number is positive or negative;


 get the sum of all positive numbers, (zero (0) is consider positive number);
 get the sum of all negative numbers; and
 print the result.

Algorithm: (5 points)
Flowchart: (5 points)

2. The CITE Clothing Company plans to give a year-end bonus to each employee. Create an
algorithm and flowchart, to compute the bonus of an employee. Consider the following criteria:
 if the employee’s monthly salary is less than P10,000.00, the bonus is 50% of the
salary;
 for employees’ with salaries greater than P10, 000.00, the bonus is P5, 000.00.
Print out the name and the corresponding bonus of the employee.

Algorithm: (5 points)
Flowchart: (5 points)

6. Assessment:

Pointing System:

5 points = all answer is correct


3 points = 2 - 3 answers is incorrect
1 point = 3 - above answers is incorrect
Laboratory Exercise No 2
Introduction to C language

1. Objective(s):
The activity aims to introduce the basic concept of C Language in programming.

2. Intended Learning Outcomes (ILOs):


At the end of the laboratory exercise, the students should be able to:

2.1. Familiarize the basic structure of C Programming Language.


2.2. Understand the basic concepts of C Language programming.

3. Discussion (not more than 300 words):

C is a general-purpose programming language, which features economy of expression, modern control


flow and data structures and a rich set of operations. It has been called as “system programming language”
because it is useful for writing compilers and operating systems.

C program Structure:
<preprocessor directive>
<declaration section>
main( )
{ /* refers to the beginning of the program */
statement;
...
statement;
} /* refers to the end of the program */

where:

1. Preprocessor Directive
- Contains information needed by the program to ensure the correct operation of Turbo
C’s standard library functions.
a. #include directive
b. #define directive

2. Declaration Section
syntax: <data type> <identifier>
ex. int x, y, z;
float f=5.67;
char g;
char name[10];
int x=10;
3. The Body of the Program
- The body of the program starts with the reserved word main( ) and is enclosed with { and }.

4. Comment /* ... */
- Where we can place anywhere in the program.

4. Resources:
Computer Unit with installed BloodShed C++

5. Procedure:
5.1

Direction: Give the meaning of the following symbols:

1. & = _______________________
2. “” = _______________________
3. * = _______________________
4. ‘’ = _______________________
5. { = _______________________
6. } = _______________________
7. \n = _______________________
8. \t = _______________________

5.2. Programming Problems


1. Create a program to calculate the area of the circle and display the result. Use the formula: Area =
Pi*r*r where Pi is approximately equal to 3.1416.

projectName: areaOfCircle
fileName: areaOfCircle

2. Create a program to convert the input Fahrenheit degree into its Celsius degree equivalent.
Use the formula: Celsius = (5/9)*(Fahrenheit – 32). Display the results.
projectName: celsius
fileName:Celsius

3. Create a program that will input a number in kilowatt and display its equivalent measure in watts.

projectName: kilowatt
fileName: kilowatt
6. Assessment (Rubric for Laboratory Performance):

Source: http://www.csulb.edu/colleges/coe/cecs/views/programs/undergrad/grade_prog.shtml