Professional Documents
Culture Documents
Program Development
Program: set of instructions, which enable computers to perform a required operation.
Types of Instructions:
a. Input/Output (I/O) Instructions: implement the transfer of data between peripherals and memory.
d. Storage/Retrieval Instructions: transfer data between accumulator and memory, i.e. copying data from
one storage location into another and retrieve as needed.
Representing the flow of the program diagrammatically and writing program’s pseudo code.
0
Compiled by.Molalign(course Instructor) Department of Computer Science
1
What is Flowchart? Diagram which uses a collection of symbols to show the step-by-step processing
activities and conditions needed to solve a problem.
Pseudo Code: model of the actual code written using normal language instead of programming language.
Conditional Statements are:
2
Logical error is caused by not using correct control structures (sequencing, selection, and iteration) in the
proper manner.
The process of testing and debugging may include:
Proofreading printout of the program line-by-line in order to identify syntax and logic errors.
Running the program.
Sample data testing.
5. Documentation of overall steps of program: programmer prepares (compile) program’s documentation.
Importance of Documentation:
Updating program in the future;
Problem diagnosis
Algorithm:
Step 1. Accept the values of A and B.
2. Compare A with B.
3. Display the result of step 2.
Flowchart:
3
Example 2: Draw flow chart and write an algorithm that adds any two numbers and display the result.
Algorithm:
Step 1. Read the values of the two numbers (A and B)
Step 2. Add A and B
Step 3. Assign the sum of A and B to C
Step 4. Display the result (C)
Flowchart:
Start
Initialize C
Read A, B
C= A+B
Print C
End
Exercises
1. Draw flowchart and write an algorithm that finds the sum of any three numbers.(A+B+C)
2. Draw flowchart and write an algorithm that finds the product of any two numbers.(A*B)
3. Draw flowchart and write an algorithm that finds the square of a number.(X2)
4. Draw flowchart and write an algorithm that checks whether a given number is positive or negative.
5. Draw flowchart and write an algorithm that checks whether a given number is even or odd.
6. Draw flowchart and write an algorithm that computes the square root of any positive number.
7. Draw flowchart and write an algorithm that computes the area of a circle ( ).
8. Draw flowchart and write an algorithm that computes the area of a triangle ( ).
9. Draw flowchart and write an algorithm that finds the sum of the first 10 natural numbers (1+2+3+ …. + 10)
10. Draw flowchart and write an algorithm that finds the sum of odd numbers (1+3+5 …. + 9)
11. Draw flowchart and write an algorithm that finds the sum of even numbers (2+4+6 …. + 10)
4
3. Draw flowchart and write an algorithm that computes the area of a circle ( ).
4. Write the algorithmic and draw a flow chart to find sum of the first 50 natural numbers (1+2+3+…. + 50).
5. Draw flowchart and write an algorithm that finds the sum of even numbers (2+4+6+ …. + 10)