Introduction
What is computer program?
A computer program, from one perspective, is a sequence of instructions. A computer
program is wriitn using a programming language specified by the programmer.
Historical Evolution of Programming Language
Ever since the concept of computer program were introduced, there have been evolution in
programming language. The evolution is mainly aimed at making the programming languages
more similar with users natural languages so that they can easily be understood by he
programmers. There are two basic categories of programming languages mainly based on their
level of abstraction. These are high level and low level programming languages. Low level
languages work at the hardware level while high level languages work at application level
1949: Assembly Language
Assembly language was used in the Electronic Delay Storage Automatic Calculator (EDSAC).
Assembly language was a type of low-level programming language that simplified the language
of machine code. In other words, the specific instructions necessary to operate a computer.
1957: FORTRAN
FORmula TRANslation or FORTRAN was created by John Backus and is considered to be the
oldest programming language in use today. The programming language was created for high-
level scientific, mathematical, and statistical computations. FORTRAN is still in use today in
some of the world’s most advanced supercomputers.
1958: ALGOL (Algorithmic Language)
Algorithmic language or ALGOL was created by a joint committee of American and European
computer scientists. ALGOL served as the starting point for the development of some of the
most important programming languages including Pascal, C, C++, and Java.
1958: LISP (List Processor)
List processor or LISP was invented by John McCarthy at the Massachusetts Institue of
Technology (MIT). Originally purposed for artificial intelligence, LISP is one of the oldest
programming languages still in use today and can be used in the place of Ruby or Python.
Companies such as Acceleration, Boeing, and Genworks are still using LISP in their tech stacks.
1959: COBOL (Common Business Oriented Language)
Common Business Oriented Language (COBOL), is the programming language behind many
credit card processors, ATMs, telephone and cell calls, hospital signals, and traffic signals
systems (just to name a few). The development of the language was led by Dr. Grace Murray
Hopper and was designed so that it could run on all brands and types of computers. COBOL is
still used to this day primarily for banking systems.
1972: C
Developed by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating
system. It was called C because it was based on an earlier language called ‘B’. Many of the
current leading languages are derivatives of C including; C#, Java, JavaScript, Perl, PHP, and
Python. It also has been/still being used by huge companies like Google, Facebook, and Apple.
1983: C++
Bjarne Stroustrup modified the C language at the Bell Labs, C++ is an extension of C with
enhancements such as classes, virtual functions, and templates. It has been listed in the top 10
programming languages since 1986 and received Hall of Fame status in 2003. C++ is used in MS
Office, Adobe Photoshop, game engines, and other high-performance software
1991: Python
Named after the British comedy troupe ‘Monty Python’, Python was developed by Guido Van
Rossum. It is a general-purpose, high-level programming language created to support a variety of
programming styles and be fun to use (a number of the tutorials, samples, and instructions often
contain Monty Python references). Python is, to this day, one of the most popular programming
languages in the world is used by companies such as Google, yahoo, and Spotify.
1995: Java
Java is a general-purpose, high-level language created by James Gosling for an interactive TV
project. It has cross-platform functionality and is consistently among the top of the world’s most
popular programming languages. Java can be found everywhere, from computers to smartphones
to parking meters.
2000: C#
Developed at Microsoft with the hope of combining the computing ability of C++ with the
simplicity of Visual Basic, C# is based on C++ and shares many similarities with Java. The
language is used in almost all Microsoft products and is seen primarily in developing desktop
applications.
2. Introduction to Algorithms
Is a sequence of instructions.
Is a procedure or formula for solving a problem
Algorithms for making things will often be divided into sections;
– the parts/components/ingredients (inputs) required to accomplish the task
– actions/steps/methods (processing) to produce the required outcome (output).
• For example to build a model car, the parts (inputs) are needed plus instructions on how to
assemble the car (processing) and the result is the car (output).
Pseudocode
Pseudocode (which means fake code, because its not really programming code) specifies the
steps required to accomplish the task.
• Pseudocode is a type of structured English that is used to specify an algorithm.
• Pseudocode cannot be compiled nor executed, and there are no real formatting or syntax rules
Help you first understand the program specifications
You must break the main tasks that must be accomplished into smaller ones in order to be
able to eventually write fully developed code.
Reduced complexity.
• Increased flexibility.
• Ease of understanding
Example 1:
Write a program that obtains two integer numbers from the user. It will print out the sum of those
numbers.
Psuedocode:
Prompt the user to enter the first integer
Prompt the user to enter a second integer
Compute the sum of the two user inputs
Display an output prompt that explains the answer as the sum
Display the result
Example 2: Finding average of any three numbers
Step 1 Start
Step 2 Read values of X, Y, Z
Step 3 S = X + Y + Z
Step 4 A = S / 3
Step 5 Write value of A
Step 6 Stop
Example 3: Finding square and cube.
Step 1 Start
Step 2 Read value of N
Step 3 S = N * N
Step 4 C = S * N
Step 5 Write values of S, C
Step 6 Stop
Example 4: Finding biggest of two numbers.
Step 1 Start
Step 2 Read A, B
Step 3 If A > B, then BIG = A, otherwise BIG = B
Step 4 Write BIG
Step 5 Stop
Example 5: Calculate pay.
Step 1 Start
Step 2 Input hours
Step 3 Input rate
Step 4 pay = hours * rate
Step 5 Print pay
Step 6 End
Flowchart
• A flowchart is a graphical representation of an algorithm.
• These flowcharts play a vital role in the programming of a problem and are quite helpful in
understanding the logic of complicated and lengthy problems.
• Once the flowchart is drawn, it becomes easy to write the program in any high level language
Build a step-by-step picture of the process for analysis, discussion, or communication
Example 1:
Algorithm: Input: two numbers x and y
Output: the average of x and y
Steps:
1. input x
2. input y
3. sum = x + y
4. average = sum /2
5. output average
Example 2: Find the area of a circle of radius r.
Example 3: Algorithm for find the greater number between two numbers.
Example 4: Flowchart for the problem of printing even numbers between 9 and 100
Example 5: Flowchart for the calculate the average from 25 exam scores
Exercise: Draw a flow diagram that shows the largest of three numbers