Algor-1a Flow Chart

Embed Size (px)

Citation preview

  • 8/2/2019 Algor-1a Flow Chart

    1/17

    Chapter 1-a

    FLOW CHART

  • 8/2/2019 Algor-1a Flow Chart

    2/17

    BACKGROUND Program :

    composed by 1 programmercomposed by 1 team of programmers

    Required planning & design using:

    FlowChart:Symbols representing the flow ofcontrol steps of a programs execution

    Objective: to simplify program-code composition

    FLOW CHART

  • 8/2/2019 Algor-1a Flow Chart

    3/17

    SYMBOLS IN FLOW CHARTSymbol for presenting

    data/input orresults/output

    Process

    flow/direction

    Symbol for results

    documentation(in hard copy)

    Symbol for readingdata/input usingpunched cards.

    Symbol of a process or

    program statement

    Start and End of aprogram indication

    Connector

    Symbol forconditional statement

    where decision isbased of whether thecondition is true orfalse

    yn

  • 8/2/2019 Algor-1a Flow Chart

    4/17

    TYPES OF INSTRUCTION

    Process A

    Process B

    Process C

    A. Unconditional Statements

  • 8/2/2019 Algor-1a Flow Chart

    5/17

    TYPES OF INSTRUCTION

    B. Conditional Statement

    Condition

    Process A Process B

    False True

  • 8/2/2019 Algor-1a Flow Chart

    6/17

    TYPES OF INSTRUCTION

    C. Looping Statements

    Condition

    Process A Process B

    False True

  • 8/2/2019 Algor-1a Flow Chart

    7/17

    EXAMPLE:1. Flow chart for buying cakes using coupons:

    Start

    Prepare Money

    Queue forbuying coupon

    Buy theCoupon

    A

    Choose Cake

    Trade cake

    for coupon

    Stop

    A

  • 8/2/2019 Algor-1a Flow Chart

    8/17

    EXAMPLE:2. Flow Chart for Study:

    Start

    PrepareEquipments

    Read Notes

    Understand

    Notes

    A

    Do theQuestions

    Match with

    Answers

    Stop

    A

    UnderstandContents

    Fit?

    Take a break

    B

    B

    yes

    no

  • 8/2/2019 Algor-1a Flow Chart

    9/17

    EXAMPLE:2. Flow Chart for Study:

    Mulai

    PersiapkanPeralatan

    Membaca materi

    MemahamiMateri

    A

    Mengerjakan

    Soal

    Cocokkandengan Jawaban

    Selesai

    A

    Memahami isi

    Sesuai?

    Istirahat

    B

    B

    ya

    tidak

  • 8/2/2019 Algor-1a Flow Chart

    10/17

    EXAMPLE:3. Find the average of 3 input data numbers:

    Start

    X = A+B+C3

    Stop

    Read: A,B,C

    Write: X

  • 8/2/2019 Algor-1a Flow Chart

    11/17

    PRACTICE QUESTIONS

    1. Given:

    A number of data

    The amount of data depends on the numberof inputs that may varies.

    Solve for :The Average of all data

    2. IF A is a negative number, add 3 to XIF Not, subtract 3 from X

    (Do it in Classroom)

  • 8/2/2019 Algor-1a Flow Chart

    12/17

    Answer 1: Start

    TTL = 0, CNT = 0

    TTL =TTL / CNT

    WRITECNT, TTL

    Stop

    CNT = CNT+ 1

    End of Data

    Write: X

    yes

    No

    Read: X

    TTL = TTL + X

  • 8/2/2019 Algor-1a Flow Chart

    13/17

    Answer 1: Start

    TTL = 0, CNT = 0

    TTL =TTL / CNT

    WRITECNT, TTL

    Stop

    CNT = CNT+ 1

    Write: X

    yes

    No

    Read: X

    TTL = TTL + X

    X = 9999

    ?

  • 8/2/2019 Algor-1a Flow Chart

    14/17

    Answer 2: Start

    X = X + 3

    A 0 ?

    Write: X

    yes

    no

    Read: A, X

    X = X - 3

    Stop

  • 8/2/2019 Algor-1a Flow Chart

    15/17

    Latihan Soal

    1. Menampilkan bilangan 1 s/ 10

    2. Menentukan apakah data yang

    dimasukkan adalah bilangan positif atau

    negatif

    3. Menentukan apakah data yang

    dimasukkan adalah bilangan genap atauganjil

  • 8/2/2019 Algor-1a Flow Chart

    16/17

    Latihan soal

    4. Tampilkan deret :

    -11, -9, -7, -5, -3, -1, 0, 2, 4, 6, 8, 10

    5. Tampilkan deret :

    -10, 8, -6, 4, -2, 0, 1, 4, 9, 16, 25

    6. Tampilkan deret :0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55

  • 8/2/2019 Algor-1a Flow Chart

    17/17

    Soal latihan

    1. Buatlah algoritma untuk menghasilkan deret :

    -10, 8, -6, 4, -2, 0, 1, 3, 6, 10, 15, 21

    2. Buatlah algoritma untuk menghasilkan deret :

    -13, 11, -9, 7, -5, 3, -1, 0, 1, 4, 9, 16, 25, 36, 49

    3. Buatlah algoritma untuk menghitung rata-rata,

    nilai maximum dan minimum dari nilai ujian

    Basic Computing