Algorithms and Programs
Algorithms and Programs
Computational Thinking
Algorithms and Programs
Slides by
Ms. Abeera Sikandar
lecturer
bahria college anchorage
computer sciences
What is an algorithm
It is a process/procedure that should be followed for some output.
Program requirement
The requirement tells you what the program must do.
For example:
Calculating a total by adding ten numbers input by the user.
Start simple
A good method is to start with a simple version of the problem. A
programmer might make a program that solves the simple
problem.
For example:
Calculate a total by adding one number input by the user.
Plan the variables
The program must have variables. They will store the values.
1. Saves time and work: it takes less time and work to make a small
change in a program, rather than writing a whole new program.
2. Less risk of an error: Repurposing the program is less risky than
writing a new program.
3. Teamwork: Sharing program with others is good teamwork.
New requirement
Program to calculate average of numbers from total.
How to turn an algorithm into a program
Combining algorithms
Programs you have made
How to combine features you’ve made
1. Programs to count inputs