You are on page 1of 8

INTRODUCTION TO C

LANGUAGE

MODULE I
OVERVIEW OF PROGRAMMING

LEARNING OBJECTIVES
At the end of this chapter, the student should
be able to: Problem solving is a natural
 Define Problem Solving
 Enumerate the Steps in Problem part of life. In any business or
Solving industry, the ability of an
 Define Program and Programming
 Enumerate and differentiate the employee to solve problems
different tools used in solving can mean the difference
programming problems
between success and failure.
LESSO TOPIC Lacking the ability to solve
N problems effectively can be a
1 Problem Solving Concepts source of anxiety and stress

2 Programming Concepts for any individual. Problem


solving is not an exact science,
although there are guidelines
that a person can follow to
become a successful problem-
solver.

Flexibility and open-


mindedness is an essential
part of being able to solve
problems, whether it is in your
personal life or on-the-job.

1|Page
Instructional Work Book
INTRODUCTION TO C
LANGUAGE

LESSON 1
PROBLEM SOLVING CONCEPTS

A. What is a problem
A problem is a state of difficulty that needs to be resolved. Problems exist
where goals need to be attained and there is uncertainty about solution.
Problem solving is the ability to determine the best solution for a problem in
a quick and efficient manner.

People make decisions every day. Everything needs a decision as a solution


to the problem.

B. Approaches to problem solving

Types of Solutions:

Algorithmic Solutions – solutions that can be solved with a series of known


actions
Examples:
o How to make a cup of coffee
o How to find the largest of three numbers
Heuristic Solutions – Employing a self-learning approach to the solution of a
problem
Examples:
o How to but the best stock
o How to play chess

Steps in Problem Solving:

1. Identify/understand the problem


2. Identify alternative ways to solve the problem
3. Select the best way to solve the problem from the list of alternative
solutions
4. List instructions that enable you to solve the problem using selected
solution
5. Evaluate the solution

2|Page
Instructional Work Book
INTRODUCTION TO C
LANGUAGE

LESSON 2

Programming Concepts

A. Problem Solving with Computers

Computers use algorithmic solutions in problem solving. It involves several


steps:

1. Analyse the problem and formulate a method to solve it.


2. Describe the solution in the form of an algorithm.
3. Draw a flowchart of the algorithm.
4. Write the computer program.
5. Compile and run the program.
6. Test the program.
7. Evaluate the result if it conforms with the problem specifications.

B. Tools used in Problem Solving

Algorithm –shows the sequence of instructions comprising a solution


Example
Algorithm: Calling a friend on the telephone
Steps:
1. Pick up the phone and listen for a dial tone. If there’s no dial tone,
press the flash button until you hear the dial tone.
2. Press each digit of the phone number on the phone
3. If busy, hang up phone, wait 5 minutes, jump to step 2
4. If no one answers, leave a message then hang up
5. If no answering machine, hang up and wait 2 hours, then jump to
step 1
6. Talk to friend
7. Hang up phone

3|Page
Instructional Work Book
INTRODUCTION TO C
LANGUAGE

Flowcharts – graphics representation of an algorithm

Start
B

Pick up the
Phone

With Dial No Press the flash


Tone? button

Yes
Press each digit of
the phone number

Yes Hang up & wait


Busy for 5 mins.
Tone
No

No one No Talk to a friend


answers

Yes Hang up phone

Stop

No No Leave a
answering Message
machine

Yes
A 4|Page
Instructional Work Book
INTRODUCTION TO C
LANGUAGE

Hang up phone
& wait for 2
hours

Pseudocode -a high-level abstraction of code, usually used to outline


the general steps in an algorithm without having to write actual code

Program Begin
Pick up the phone and listen to the dial tone
Repeat
Press flash button
Until there’s a dial tone

Repeat
Press each digit of the phone number
If busy tone then
Hang up and wait for 5 mins
Else
If there’s an answering Machine then
Leave a Message
Else
Hang up phone and wait for 2 hours
End if
End if
Until someone answered
Talk to a friend
Hang up phone
Program End

5|Page
Instructional Work Book
INTRODUCTION TO C
LANGUAGE

C. Communicating with a Computer

Program –is a set of step-by-step instructions that directs the computer to perform
tasks and produce results.

Programming Language - is a set of rules that instructs a computer what


operations to perform.

Programming - is the process of designing, writing, testing, debugging /


troubleshooting, and maintaining the source code of computer programs.

6|Page
Instructional Work Book
INTRODUCTION TO C
LANGUAGE

NAME: ______________________________ SCORE: ________


Course/Year/Section : _____________ ____ Date : __________

CONCEPT REVIEW

Multiple Choice: Write the letter of the correct answer on the space provided.
___1. It is a state of difficulty that needs to be resolved
A. Problem B. Program C. Programming D.Problem
Solving
___2. It is the ability to determineto determine the best solution for a problem in a
quick and efficient manner.
A. Problem B. Program C. Programming D.Problem
Solving
___3. A solutions that can be solved with a series of known actions.
A. Heuristic B. Algorithmic C.No Valid answer
___4. It shows the sequence of instructions comprising a solution
A. pseudocode B. algorithm C. flowchart

___5. Employing a self-learning approach to the solution of a problem


A. Heuristic B. Algorithmic C. no valid answer

___6. A graphics representation of an algorithm


A. pseudocode B. algorithm C. flowchart

___7. A high-level abstraction of code, usually used to outline the general steps in
an algorithm without having to write actual code
A. pseudocode B. algorithm C. flowchart

___8. It is a set of step-by-step instructions that directs the computer to perform


tasks and produce results.
A. Program B. Programming C. Compiler D. None of
Language the choices

___9. It is the process of designing, writing, testing, debugging / troubleshooting,


and maintaining the source code of computer programs.

7|Page
Instructional Work Book
INTRODUCTION TO C
LANGUAGE

A. Program B. Programming C. Compiler D. None of


Language the choices
___10. It is a set of rules that instructs a computer what operations to perform.
A. Program B. Programming C. Compiler D. None of
Language the choices

8|Page
Instructional Work Book

You might also like