Computer Programing
and Fundamentals
Introduction
• Computer cannot perform any task
• Simple or complex
• Of its own
• It has to be instructed about how to perform the task
• Set of instructions that instruct thecomputer
• Steps while writing a program
• Characteristics of a good program
Program Development Life Cycle
Accept the input data that needs to be processed
Act upon the input data and process it
Provide output to the user
Specific sequence
• Problem analysis
• Program design
• Program development
• Program documentation and maintenance
Program design
• Algorithm : english like explanation of solution
• Flowchart : diagramamatic represenation of solution
• Pseudo code : structured programming constructs.
becomes the input to the next phase
• Chose a programming language
• Write the program by converting the pseudo code and
then using the programming language
• Test the program
• Modify the program
• Install the tested program on the user‘s computer
Algorithm
• Ordered sequence of well defined, umambigous finite instructions for
completing a task
• English like representation
• Step by step procedure for solving a problem
• Different algorithms differin their requirements of time and space
• The programmer selects the best suited algorithmfor the given task to be
solved
Algorithm
• Start
• Read the three numbers A, B, C
• Compare A and B. If A is greater perform step 4 else perform step 5.
• Compare A and C. If A is greater, Ouput ‘‘A is greatest‘‘ else output
‘‘C is greatest‘‘. Perform step 6
• Compare B and C. If B is greater, Ouput ‘‘B is greatest‘‘ else output
‘‘C is greater‘‘.
• Stop
• Start
• Read the three numbers A, B, C
• Compare A and B. If A is greater, store A in MAX, Else
store B in MAX
• Compare MAX and C. If MAX is greater, output ‘‘MAX is
greatest‘‘ else output ‘‘C is the greatest‘‘
• Stop
Flow chart
Pseudo Code
• Short
• Readable
• Formally styled english
• Used for explaining Algorithms
• Short hand way of describing a program
• To understand the geberal working of a program
• No standard of syntax for pseudo code exists
• No requirement of programming language
Preparing pseudo code
• Using structured english
• Some terms are commonly used to represent various
actions for example INPUT GET READ OUTPUT DISPLAY
• Controlled structure sequence selection iteration
• WHILE and DO-WHILE are two iterative statments
• READ values of A,B and C
• IF A is greater then B THEN Assign A toMAX
• ELSE Assign B to MAX
• IF MAX is greater than C THEN PRINT MAX is greater
ELSE PRINT C is greatest
• STOP
• Algorithm is a sequence of instructions used to solve a
particular proramg.
• Flow chart and pseudo codeare tools to document and
represent algorithm
Programming paradigms
It means an example that serves as a pattern or a model.
Programming paradigms are different patternsand models
for writing a program
They are classified as
Structured prgramming
Object oriented programming
Aspect oriented programming
Structured programming
• Building of of programs using small modules. They are
easy to read and write
• The problemto be solved isbroken down into small tasks
that can be written independently
• Procedural programming
• Modular programming
Characteristics of a good program
• Well writte and easily understandable
• Readable and structured
• Must be a general program not specific to some input
values
• Well documentedshould be designed with minimum
independence ona particular operating system