Professional Documents
Culture Documents
Algorithm Sing
Algorithm Sing
Flowcharts
A flowchart is the combination of geometric symbols connected with arrows that represent
steps in a process.
2
Start
Input
a, b, c
abc
s
2
A s * (s a)* (s b)* (s c )
P=2*s
Output
A,P
End
Figure 1 Flow chart for calculating the area and perimeter for any triangle
Example
So you want my phone number and need to know my BMI? How shallow can you get? In
1998, the federal government developed the body mass index (BMI) to determine ideal
weights. Body mass index is calculated as 703 times the weight in pounds divided by the
square of the height in inches, the obtained number is then rounded off to the nearest whole
3
number (Hint: 23.5 will be rounded to 24; 23.1 will be rounded to 23; 23.52 will be rounded
to 24). Criteria for a healthy weight is given as follows.
4
Start
Input
Weight, W Weight in lbs
& Height in inches
Height, H
W
BMI * 703
H2
round(BMI)
No Yes
Is
19≤BMI≤
25?
Output Output
Unhealth Healthy
y Weight
Weight
End
5
x2 x3 x4
ex 1 x ........
2! 3! 4!
Start
Input
n,x
sum=0
for
i from 0
by 1 to
n-1 do
Output
sum
Add
x^i/i! to
sum;
End
6
Start
Input
n,x
i=0
sum=0
No Is
i<n?
Yes
Output
sum
Add x^i/i!
to sum;
i=i+1;
End
Figure 4: Alternate Flow Chart to Figure 3 for Calculating the Maclaurin Series
7
Start
Input
n,x,
tol
No
Is i<n and absea>tol?
Yes
Output
sum
sumprev=sum
Add x^i/i! to sum;
i=i+1;
Calculate absolute relative sumprev is the
End
approx error previous sum
needed to
calculate absea