Presentation is loading. Please wait.

Presentation is loading. Please wait.

Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

Similar presentations


Presentation on theme: "Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers."— Presentation transcript:

1 Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers

2 START

3 Read in A, B and C

4 START A>B? Read in A, B and C

5 START A>B? Read in A, B and C Yes A>C?

6 START A>B? No Read in A, B and C Yes A>C?B>C?

7 START A>B? No Read in A, B and C Yes A>C?B>C? Biggest = C No

8 START A>B? No Read in A, B and C Yes A>C?B>C? Biggest = ABiggest = C Yes No

9 START A>B? No Read in A, B and C Yes A>C?B>C? Biggest = ABiggest = CBiggest = B Yes No

10 START A>B? No Read in A, B and C Yes A>C?B>C? Biggest = ABiggest = CBiggest = B Yes No

11

12 A>B?

13 Yes B<C?

14 A>B? Yes B<C?A<C? No

15 A>B? No Yes B<C?A<C? No

16 A>B? No Yes B<C?A<C? Smallest = C No

17 A>B? No Yes B<C?A<C? Smallest = ASmallest = C Yes No

18 A>B? No Yes B<C?A<C? Smallest = ASmallest = CSmallest = B Yes No

19 A>B? No Yes B<C?A<C? Smallest = ASmallest = CSmallest = B Yes No

20 A>B? No Yes B<C?A<C? Smallest = ASmallest = CSmallest = B Yes No Print Smallest + Biggest

21 A>B? No Yes B<C?A<C? Smallest = ASmallest = CSmallest = B Yes No Print Smallest + Biggest END

22 Flowcharts So let’s say we want to express the following algorithm to print out the biggest of four numbers

23 START

24 Read in A, B, C and D

25 START A>B? Read in A, B, C and D

26 START A>B? Yes Read in A, B, C and D X = A

27 START A>B? No Yes Read in A, B, C and D X = A X = B

28 START A>B? No Yes Read in A, B, C and D X = A X = B

29 START A>B? No Yes Read in A, B, C and D X = A X = B C>D?

30 START A>B? No Yes Read in A, B, C and D X = A X = B C>D? Yes Y = C

31 START A>B? No Yes Read in A, B, C and D X = A X = B C>D? No Yes Y = C Y = D

32 START A>B? No Yes Read in A, B, C and D X = A X = B C>D? No Yes Y = C Y = D

33 START A>B? No Yes Read in A, B, C and D X = A X = B C>D? No Yes Y = C Y = D

34

35 X>Y?

36 Yes Print X

37 X>Y? No Yes Print X Print Y

38 X>Y? No Yes Print X Print Y

39 X>Y? No Yes Print X Print Y END

40 Symbols

41

42 Terminal Input/Output Operation Process Decision Connector Module Symbols


Download ppt "Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers."

Similar presentations


Ads by Google