Introduction
Computer
programming is a set of instructions through which one tells
the
computer to do the desired task. This set of instructions written in
human
readable computer language is called Source Code. Every program
has two
parts namely code and data. There are two models of
programming
namely Structured Programming and Object Oriented
Programming.
In Structured Programming codes are executed one after
one in
a serial fashion. Example for this is ‘C’ Language. In object
oriented
programming, data is accessed through objects. There is no
single
flow. Here objects freely interact with one another by passing
messages.
Problem
Solving Techniques
To
develop the solution for the given problem, the following programming
techniques
are used.
Problem
solving techniques
i) Algorithm-
Algorithm
is a step by step procedure to solve any problem.
ii) Flow
Charts-
Flow Chart is a graphical represantation of the
steps involved in a programme.
iii) Pseudo codes-
These
are the instructions written in ordinary English using
mathematical
and logical symbols to display the program logic.
iv) Decision Tables-
A
decision table consists of many independent conditions with several
actions, written in table
format to solve the given problem.
Properties of
an Algorithm
i. Finiteness:
An algorithm must always terminate after a finite
number
of steps.
ii. Definiteness:
Each step must be clearly defined that actions
carried
out must be unambiguous.
iii. Input:
Input should be provided at the beginning of algorithm.
iv. Output:
Algorithm must produce on or more output.
v. Effectiveness:
All the operations defined must be sufficiently basic
that they can be done
exactly in finite length of time manually.
Basic Statements Used and Examples
i.
Algorithm always begins with the word ‘Start’ and ends with the word
‘Stop’
ii.
Step wise solution is written in distinguished steps. This is as shown in
example
1
Start
Step 1:
Step 2:
Step 3:
.
.
.
Step n:
End
Ex.:- Calculate the
greater number between three numbers.
Ans.-
1. Start the Algorithm.
2. Take three numbers from
the user.
3. If the first number
greater than second number and the first number is greater than the third
number, then display first number is greatest.
4. Else if second number
is greater than first number and first number is greater than third number,then
display second number is greatest.
5. Else third number is
greatest.
6. Stop the algorithm
No comments:
Post a Comment