Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
0 of .
Results for:
P. 1
1. Programming in ‘C’

# 1. Programming in ‘C’

Ratings: (0)|Views: 3,088 |Likes:

### Availability:

See more
See less

05/11/2014

pdf

text

original

1. Programming in ‘C
PROGRAM DEVELOPMENT TOOLS
1.1 Algorithm
Algorithm is a method of representing the step-by-step logical procedure for  solving a problem
. According to D.E. Knuth, a pioneer in the computer sciencediscipline, an algorithm must possess the following properties(i)
Fitness:
An algorithm must terminate in a finite number of steps(ii)
Definiteness:
Each step of the algorithm must be precisely andunambiguously stated.(iii)
Effectiveness:
Each step must be effective, in the same that it should be primitive (easily converted into program statement) and can be performedexactly in a finite amount of time.(iv)
Generality:
The algorithm must be complete in itself so that it can beused tosolve all problems of a specific type for any input data.(v)
Input / Output:
Each algorithm must take zero, one or more quantities aninput data and produce one or more output values.An algorithm can be written in English like sentences or in any standardrepresentation. Sometimes, algorithm written in English like language is called
PseudoCode.Example: Suppose we want to find the average of three numbersStep 1.
Read the numbers a, b, c
Step 2.
Compute the sum of a, b and c
Step 3.
Divide the sum by 3
Step 4.
Store the result in variable d
Step 5.
Print the value of d
Step 6.
End of the programFormally, an algorithm can be defined as
an ordered sequence of well-defined and effective operations that, when executed, will always produce a result and eventually terminate in a finite amount of time.
MILLENNIUM SOFTWARE SOLUTIONS
Visakhapatnam

1.2 Flowchart
Flowchart is diagrammatic representation of an algorithm
. It is constructedusing different types of
boxes and symbols
. Arrows among themselves to indicate theflow of information and processing connect all symbols.
Following are the Standard symbols used in drawing flowcharts.O
val
T
erminal
P
arallelogram
I
nput/ output
D
ocument
P
rintout
ectangle
P
rocess
D
iamond
D
ecision
C
ircle
C
onnector
A
rrow
F
low
D
ouble sidedRectangle
P
redefinedProcess
Important Points in drawing flowcharts
1.Flowchart should be clear, neat and easy to follow2.Flowchart should be logically correct3.Flowchart should be verified for its validity with some test data
Limitations of flowcharts
1.Flowcharts are difficult to modify. Re-drawing of flowchart may be necessary2.Translation of flowchart into computer program is always not easy
MILLENNIUM SOFTWARE SOLUTIONS
Visakhapatnam

1.Logic of program is clearly represented2.It is easy to follow logically the flow chart
Example: Find out the average of n numbers.

TrueFalse
MILLENNIUM SOFTWARE SOLUTIONS
Visakhapatnam
StartRead NCount = 0Sum = 0Avg = 0Sum = Sum + aCount = Count+1Count<=n?Avg = sum / nPrintavg.Stop