Chapter One
Introduction to
Programming
1
By: Senbetu A.
Sep, 2025
Jinka, Ethiopia 12/04/2025
Contents
Introduction to programming
Problem solving Techniques
Flowchart
Pseudo code
Structured chart
12/04/2025 2
Introduction to programming
Computer ?
an electronic device that accepts data,
performs computations, and makes logical decisions according to
instructions that have been given to it
then produces meaningful information in a form that is useful to the user
Computer programs ?
Sets of instructions that control a computer’s processing of data.
the instructions that tells the computer hardware what to do.
Computer programming ?
is the process of writing, testing, debugging / troubleshooting, and
maintaining the source code of computer programs 12/04/2025 3
Continued…
Computer programs (also known as source code) is often written by
professionals known as Computer Programmers
A computer program usually consists of two elements:
Data – characteristics
Code – action
Source code is written in one of programming languages
12/04/2025 4
Continued…
What is Programming Language?
Is an artificial language that can be used to control the behavior of a computer
defined by
Syntactic - describes the possible combinations of symbols that form a
syntactically correct program
Semantic - The meaning given to a combination of symbols
computers do exactly what they are told to do
Programming languages can be divided in to two major categories:
low-level
high-level languages
12/04/2025 5
Continued…
Machine language:
machine is short for computing machine (i.e., computer)
computer’s native language, sequence of zeroes and ones different computers
understand different sequences
hard for humans to understand: 01010001…
Assembly language: mnemonics for machine language
low level: each instruction is minimal
still hard for humans to understand: ADD d0,d2
High-level languages
FORTRAN, Pascal, BASIC, C, C++, Java, COBOL, etc.
high level: each instruction composed of many low-level instructions
closer to English easier to read and understand: e.g., 12/04/2025
hypotenuse= [Link](opposite*opposite+adjacent*adjacent);
6
Problem solving Techniques
Computer solves varieties of problems that can be expressed in a finite number of
steps
In computer programming two facts :
Defining the problem and logical procedures to follow in solving it.
Introducing the means by which programmers communicate those
procedures to the computer system so that it can be executed.
12/04/2025 7
Continued…
There are system analysis and design tools, particularly flowchart and structure
chart, that can be used to define the problem in terms of the steps to its
solution.
The programmer uses programming language to communicate the logic of the
solution to the computer.
An algorithm is defined as a step-by-step sequence of instructions that must
terminate and describe how the data is to be processed to produce the desired
outputs.
12/04/2025 8
Simply, algorithm is a sequence of instructions
Continued…
programs could be written in terms of 3 structures:
Sequence – which instruction should be done next?
Selection – select between options
Repetition – repeat an action while a given condition stays true
An algorithm can be represented as
Flowchart
Pseudo code
Structured chart
12/04/2025 9
Flow Chart
A graphic representation of an algorithm,
often used in the design phase of programming to work out the logical flow of a
program
12/04/2025 10
Continued… Flowchart Symbol
12/04/2025 11
Continued…
Example 1:
Draw flow chart of an algorithm to add two numbers and display their result.
Algorithm description
1. Read the two numbers (A and B)
2. Add A and B
3. Assign the sum of A and B to C
4. Display the result ( c)
12/04/2025 12
Continued…
Flow Chart is :
Start
Read A, B
C= A+B
Print C
End 12/04/2025 13
Continued…
Example 2:
Write an algorithm description and draw a flow chart to check a number is
negative or not.
Algorithm description
1. Read a number x
2. If x is less than zero write a message negative else write a message not
negative
12/04/2025 14
Continued… Flow Chart is :
12/04/2025 15
Pseudo code
is an artificial and informal language that helps programmers develop algorithms
a shorthand notation for programming which uses a combination of informal
programming structures and verbal descriptions of code.
In general, pseudocode is used to outline a program before translating it into
proper syntax.
12/04/2025 16
Continued…
Example-1:
Write a program that prints “passed” when the student grade is greater than
60 and “failed” otherwise.
Solution:-
If student's grade is greater than or equal to 60
◦ Print "passed"
else
◦ Print "failed“
12/04/2025 17
Continued…
Example-2:
◦Pseudo-code the task of computing the final price of an item after figuring in sales
tax. Note the three types of instructions: input (get), process/calculate (=) and
output (display)
1. get price of item
2. get sales tax rate
3. sales tax = price of item times sales tax rate
4. final prince = price of item plus sales tax
5. display final price
12/04/2025 18
6. stop
Continued…
Example-3:
Write a program that obtains two integer numbers from the user. It will print out
the sum of those numbers.
1. Prompt the user to enter the first integer
[Link] the user to enter a second integer
[Link] the sum of the two user inputs
[Link] an output prompt that explains the answer as the sum
[Link] the result
12/04/2025 19
Structure Chart
depicts the logical functions to the solution of the problem using a chart.
It provides an overview that confirms the solution to the problem without
excessive consideration to detail.
It is high-level in nature.
12/04/2025 20
Continued…
Example-1:
Write a program that asks the user to enter a temperature reading in centigrade
and then prints the equivalent Fahrenheit value.
Input Process Output
Centigrade Prompt for centigrade value Fahrenheit
Read centigrade value
Compute Fahrenheit value
Display Fahrenheit value
12/04/2025 21
end of Chapter 1
Thank you for you
attention!
?
By: Senbetu a.
[Link]@[Link]
12/04/2025 22