Explaining on what is a program ,how a program development is done with a study on program development life cycle,Algorithm ,characteristics of an algorithm,few examples
1. Program Development Life Cycle,
Algorithm
MARY SANJANA JOSEPH
DEPARTMENT OF COMPUTER SCIENCE
KRISTU JAYANTI COLLEGE
BANGALORE
2. Program
oA computer program or a program, is a sequence of instructions, written to perform a specified
task on a computer.
oIt is a sequence or set of instructions in a programming language for a computer to execute
oA computer requires programs to function, typically executing the program's instructions in a
central processor.
KRISTU JAYANTI COLLEGE
3. Program
A computer program, or just a program, is a sequence of instructions, written to perform a specified task on a computer.
A computer requires programs to function, typically executing the program's instructions in a central processor.
The program has an executable form that the computer can use directly to execute the instructions.
The same program in its human-readable source code form, from which executable programs are derived (e.g., Compiled), enables a programmer
to study and develop its algorithms.
A collection of computer programs and related data is referred to as the software.
Computer source code is typically written by computer programmers.
KRISTU JAYANTI COLLEGE
4. Program Development
oProgram development is an ongoing systematic process that professionals follow as they plan,
implement and evaluate problem statement.
oThe process is not confined to a planning cycle.
oIt can be applied on a small scale to an individual program; on a larger scale to an entire
enterprise level software.
oThe scope may be different but the principles of program development remain the same.
KRISTU JAYANTI COLLEGE
6. Program Development Life Cycle
1. Analyze the problem
Precisely define the problem to be solved, and write program specifications – descriptions
of the program’s inputs, processing, outputs, and user interface.
Example:
Problem : To find the sum of natural numbers
Inputs : 2 positive numbers
Processing : Adding first number and second number and storing/Print the result
User Interface : Any Programming Language (C compiler)
KRISTU JAYANTI COLLEGE
7. PDLC
2. Design the program
Develop a detailed logic plan using a tool such as pseudocode,
flowcharts, object structure diagrams, or event diagrams to group the
program’s activities into modules; devise a method of solution or
algorithm for each module; and test the solution algorithms.
KRISTU JAYANTI COLLEGE
8. PDLC
3. Code the program
Translate the design into an application using a programming language or
application development tool by creating the user interface and writing
code; include internal documentation – comments and remarks within the
code that explain the purpose of code statements.
KRISTU JAYANTI COLLEGE
9. #include<stdio.h>
main()
{
int A, B, Sum; // Declaration
printf(“ Enter the first number”);
scanf(%d”, &A); // Get the first input from the user
printf(“ Enter the Second number”);
scanf(%d”, &B); // Get the second input from the user
Sum=A+B; // Add the numbers and store it in a variable
printf(“ The Sum of the numbers is %d”,Sum); // Print the output
getch() ;
} KRISTU JAYANTI COLLEGE
10. PDLC
4. Test and debug the program
Test the program, finding and correcting errors (debugging) until it is error free and contains
enough safeguards to ensure the desired results.
5. Formalize the solution
Review and, if necessary, revise internal documentation; formalize and complete end-user
(external) documentation
6. Deployment and Maintanace
Provide education and support to end users; correct any unanticipated errors that emerge and
identify user-requested modifications (enhancements). Once errors or enhancements are
identified, the program development life cycle begins again at Step 1.
KRISTU JAYANTI COLLEGE
11. Algorithm
An algorithm is a series of specific steps to solve a particular problem.
It is a sequence of unambiguous instructions for solving a problem in a finite amount of time.
KRISTU JAYANTI COLLEGE
12. Qualities of Good Algorithm
Inputs and outputs should be defined precisely.
Each steps in algorithm should be clear and unambiguous.
Algorithm should be most effective among many different ways to solve a problem.
An algorithm shouldn't have computer code.
Instead, the algorithm should be written in such a way that, it can be used in similar programming languages.
KRISTU JAYANTI COLLEGE
13. Characteristics of an Algorithm.
Finiteness
The algorithm must always terminate after a finite number of steps.
If we trace out the instructions of an algorithm, then for all cases,
the algorithm terminates after a feasible number of finite steps.
Definiteness :
Each and every instruction should be precise and unambiguous i.e.
each and every instruction should be clear and should have only one
meaning
KRISTU JAYANTI COLLEGE
14. Characteristics/properties of an
Algorithm.
Input:
The algorithm should have zero or more inputs that are given to it initially before the algorithm
begins or dynamically as the algorithm runs.
Output :
An algorithm should have one or more output that have a specified relation to the inputs. An
algorithm should produce at least one or more outputs.
Efficiency :
The algorithm efficiency is measured by calculating the amount of time it takes for execution
and the amount of memory needed for it to execute.
KRISTU JAYANTI COLLEGE
15. Levels of Description
1. High-level description
It describes an algorithm, ignoring the implementation details.
2. Implementation description
It is used to define the way the implementation is done
3. Formal description
It is the most detailed having the "highest level" of detail.
KRISTU JAYANTI COLLEGE
16. Steps for Writing an Algorithm
1. Get a clear understanding of the problem statement.
2. Proceed in a step by step fashion.
3. Divide the job into smaller chunks.
4. Include variables and their usage and define expressions.
5. Outline each loop
6. Include action statements.
7. Work outwards from the Action Statements, figuring out how each parameter
will be determined each time the loop goes around
8. Go back to step number if loop or condition fails.
9. Use jump statement to jump from one statement to another.
10. Try to avoid unwanted raw data in algorithm.
11. Break and stop to terminate the process.
KRISTU JAYANTI COLLEGE
17. Algorithm To Print Sum of Two Numbers
STEP 1: Start
STEP 2 : Read the value of a , b, c
STEP 3 : Calculate c = a + b
STEP 4 : Print c
STEP 5 : STOP
KRISTU JAYANTI COLLEGE
18. Find the given Number is Positive or Not
Step 1:Start
Step 2:Read num
Step 3 : if num > 0 then goto step 4 else goto step 5
Step 4: print num is positive
Step 5 : print num is negative
Step 6 : stop
KRISTU JAYANTI COLLEGE
19. Find Circumference of A Circle
Step 1: Start
Step 2 : Read r = 23, pi =3.14, c
Step 3 : Compute c = 2 * pi * r
Step 4 : Print circumference
Step. 5 : Stop
KRISTU JAYANTI COLLEGE