ICT Lesson 2 - Pseudo Codes and Flow Charts by Aluth.com

download ICT Lesson 2 - Pseudo Codes and Flow Charts by Aluth.com

of 15

Transcript of ICT Lesson 2 - Pseudo Codes and Flow Charts by Aluth.com

  • 8/17/2019 ICT Lesson 2 - Pseudo Codes and Flow Charts by Aluth.com

    1/15

    Information and Communication Technology – Namal Dissanayake 077-2444500 Page 1

    Pseudo Codes and Flow Charts

    Namal Dissanayake

    (Pseudo Codes)

    ( shorthand ) . .

    .

    ( Flow Chart )

    / .

    .

    /

    Start/Stop

    /

    Input/Output

    Process

    Decision

    Connector

    Data Flow

  • 8/17/2019 ICT Lesson 2 - Pseudo Codes and Flow Charts by Aluth.com

    2/15

    Information and Communication Technology – Namal Dissanayake 077-2444500 Page 2

    .

    .

    x y total .

    ,

    A B mul .

    ,

    Start

    Input x,y

    Total = x+y

    Display Total

    Stop

    BeginInput x,y

    Total = x+y

    Display totalEnd

    Start

    Input a,b

    Mul = a*b

    Display Mul

    Stop

    BeginInput a,bMul = a*bDisplay MulEnd

  • 8/17/2019 ICT Lesson 2 - Pseudo Codes and Flow Charts by Aluth.com

    3/15

    Information and Communication Technology – Namal Dissanayake 077-2444500 Page 3

    l w a .

    ,

    r c  .

    ,

    Start

    Input l,w

    a = l*w

    Display a

    Stop

    BeginInput l,wa = l*wdisplay aEnd

    Start

    Input r

    = 2 ∗ ∗

    Display c

    Stop

    BeginInput r

    = 2 ∗ ∗

    Display cEnd

  • 8/17/2019 ICT Lesson 2 - Pseudo Codes and Flow Charts by Aluth.com

    4/15

    Information and Communication Technology – Namal Dissanayake 077-2444500 Page 4

    a,b,c avg .

    ,

    l h a .

    ,

    BeginInput a,b,cAvg = a+B+C/3Display avgEnd

    =1

    2∗ ∗ ℎ

    BeginInput l,h

    Display aEnd

    Start

    Input l,h

    =1

    2 ∗ ∗ ℎ

    Display a

    Stop

    Start

    Input a,b,c

    Avg = a+b+c/3

    Display Avg

    Stop

  • 8/17/2019 ICT Lesson 2 - Pseudo Codes and Flow Charts by Aluth.com

    5/15

    Information and Communication Technology – Namal Dissanayake 077-2444500 Page 5

    20% . bill discount

    .

    ,

    payment .

    ,

    BeginInput bill

    Discount = biil *

    Display DiscountEnd

    Start

    Input bill

    Discount = bill *

    Display Payment

    Stop

    Payment = bill - discount

    BeginInput bill

    Discount = bill *

    Payment = bill – discount

    Display paymentEnd

    Start

    Input bill

    Discount = bill *

    Display Discount

    Stop

  • 8/17/2019 ICT Lesson 2 - Pseudo Codes and Flow Charts by Aluth.com

    6/15

    Information and Communication Technology – Namal Dissanayake 077-2444500 Page 6

    marks 50 50 pass 50 fail .

    yes

    no

    ,

    age 18 adult, 18 child

    .

    Start

    Input marks

    IfMarks>= 50

    Display “fail”

    Display “pass”

    Stop

    BeginInput marksIf marks>=50 so;Then

    Display “pass”Else

    Display “fail”End ifEnd

  • 8/17/2019 ICT Lesson 2 - Pseudo Codes and Flow Charts by Aluth.com

    7/15

  • 8/17/2019 ICT Lesson 2 - Pseudo Codes and Flow Charts by Aluth.com

    8/15

    Information and Communication Technology – Namal Dissanayake 077-2444500 Page 8

    yes

    no

    ,

    M 75 A , 65 B , 50 C , 50 W ,

    .

    BeginInput TIf>=25 Then

    Display “hot”Else

    Display “cold”End ifEnd

    Start

    Input T

    IfT>= 25

    Display “cold”

    Display “hot”

    Stop

  • 8/17/2019 ICT Lesson 2 - Pseudo Codes and Flow Charts by Aluth.com

    9/15

    Information and Communication Technology – Namal Dissanayake 077-2444500 Page 9

    ,

    yes

    no

    yes

    no

    yes

    no

    .

    Start

    Input M

    IfM>= 75

    IfM>= 65

    IfM>= 50

    Display “A”

    Display “B”

    Display “C”

    Stop

    Display “W”

    BeginInput M

    If m>=75Then

    Display “A”ElseIf m>= 65Then

    Display “B”ElseIf m>=50

    Display “C”

    ElseDisplay “W”

    End ifEnd ifEnd ifEnd

  • 8/17/2019 ICT Lesson 2 - Pseudo Codes and Flow Charts by Aluth.com

    10/15

    Information and Communication Technology – Namal Dissanayake 077-2444500 Page 10

    yes ,

    no

    .

    ,

    yes

    no

    Start

    Input x,y

    IfX> Y

    Display “Y”

    Display “X”

    Stop

    BeginInput x,yIf x>yThen

    Display “X”Else

    Display “Y”End ifEnd

    BeginInput x,yIf y>xThen

    Display “X”Else

    Display “Y”End ifEnd

    Start

    Input x,y

    IfY>X

    Display “Y”

    Display “X”

    Stop

  • 8/17/2019 ICT Lesson 2 - Pseudo Codes and Flow Charts by Aluth.com

    11/15

  • 8/17/2019 ICT Lesson 2 - Pseudo Codes and Flow Charts by Aluth.com

    12/15

    Information and Communication Technology – Namal Dissanayake 077-2444500 Page 12

    ,

    yes

    no

    yes

    no

    yes

    no

    Start

    Display “ ”If

    ADNO/4Balance =0

    If

    ADNO/4Balance =1

    IfADNO/4

    Balance =2

    Input ADNO

    Display ”

    Display “ ”

    Stop

    BeginInput ADNOIf ADNO/4=0Then

    Display “ ”ElesIf ADNO/4=1Then

    Display ” “ElseIf ADNO/4=2Then

    Display “ ”Else

    Display “ ”End ifEnd ifEnd ifend

    Display “ ”

  • 8/17/2019 ICT Lesson 2 - Pseudo Codes and Flow Charts by Aluth.com

    13/15

    Information and Communication Technology – Namal Dissanayake 077-2444500 Page 13

    Microsoft 5 .

    yes

    ,

    no

    Start

    Input “Microsoft”

    IfX

  • 8/17/2019 ICT Lesson 2 - Pseudo Codes and Flow Charts by Aluth.com

    14/15

  • 8/17/2019 ICT Lesson 2 - Pseudo Codes and Flow Charts by Aluth.com

    15/15