Program Mng

  • View
    223

  • Download
    0

Embed Size (px)

Text of Program Mng

  • 8/11/2019 Program Mng

    1/14

    Katrina Coleen C. CarpioBSA 4 2

    1. Create a flowchart that will compute the area and perimeter of a square.

    Start

    SIDE = 0AREA = 0

    PERIMETER = 0

    Input SIDE

    Area = SIDE * SIDE

    Perimeter = 4 * SIDE

    Print The AREA is , area Print The PERIMETER is, perimeter.

    End

    Let SIDE be the side of the square.Let AREA be the area of thesquare.Let PERIMETER be the perimeter

    of the square.

  • 8/11/2019 Program Mng

    2/14

    2. Create a flowchart that will input two numbers and display the sum, product, anddifference.

    Start

    N1 = 0 PRODUCT = 0N2 = 0 DIFFERENCE = 0SUM = 0

    Input N1, N2

    SUM = N1 + N2PRODUCT = N1 * N2

    DIFFERENCE = N1 N2

    Print The SUM is , sum Print The PRODUCT is, product.

    Print The DIFFERENCE is, difference.

    End

    Let N1 be the 1 st number.Let N2 be the 2 nd number.Let SUM be the sum. Let PRODUCT be the product.Let DIFFERENCE be the difference.

  • 8/11/2019 Program Mng

    3/14

    3. Input age and display you can vote if age is 18 above otherwise display you cannot vote.

    Start

    AGE = 0

    Input AGE

    AGE > = 18

    End

    Print You cannot vote

    Print You can vote YES

    NO

  • 8/11/2019 Program Mng

    4/14

    4. Input a number and display if it is in positive or negative. Assumption : 0 is considerednegative.

    Start

    N = 0

    Input N

    N > 0

    End

    Print NEGATIVE

    Print POSITIVE YES

    NO

  • 8/11/2019 Program Mng

    5/14

    5. Input a number and display if it is odd or even.

    Start

    N = 0

    Input N

    N mod 2 = 0

    End

    Print ODD

    Print EVEN YES

    NO

  • 8/11/2019 Program Mng

    6/14

    6. Input a number except 0, display if it is in positive or negative.

    Start

    N = 0

    Input N

    N > 0

    End

    Print NEGATIVE

    Print POSITIVE

    YES

    NO

    N = = 0

    NO

  • 8/11/2019 Program Mng

    7/14

    7. Print numbers from 1 to 5.

    NOTE : If counter starts with 0

    Start

    COUNTER = 0

    Print COUNTER

    COUNTER = COUNTER + 1

    COUNTER = = 5 End

    Increment counter by 1

    NO

    YES

  • 8/11/2019 Program Mng

    8/14

    NOTE : If counter starts with 1

    Start

    COUNTER = 1

    Print COUNTER

    COUNTER = COUNTER + 1

    COUNTER = = 6 End

    NO

    YES

    Increment counter by 1

  • 8/11/2019 Program Mng

    9/14

    8. Input 5 numbers and display the sum.

    Start

    COUNTER = 0N = 0

    SUM = 0

    Input N

    COUNTER = COUNTER + 1

    COUNTER = = 5

    NO

    YES

    SUM = SUM + N

    Print The SUM is

    End

    Increment counter by 1

  • 8/11/2019 Program Mng

    10/14

    9. Flowchart that prints multiples of 10 from 1000 to 200.

    Start

    COUNTER = 1000

    Print COUNTER

    COUNTER = COUNTER 10

    COUNTER = = 190 End

    NO

    YES

    Decrement counter by 10

  • 8/11/2019 Program Mng

    11/14

  • 8/11/2019 Program Mng

    12/14

    11. Input 5 numbers and display the product.

    Start

    COUNTER = 0NUMBER = 0

    PRODUCT = 1

    Input NUMBER

    PRODUCT = PRODUCT * NUMBER

    COUNTER = COUNTER + 1

    COUNTER = = 5

    End

    NO

    YES

    Increment counter by 1

    Print The PRODUCT

    is, product.

  • 8/11/2019 Program Mng

    13/14

    12. Input 10 numbers and display how many numbers are greater than 5.

    Start

    COUNTER = 0NUMBER = 0

    CTR_G = 0

    Input NUMBER

    COUNTER = = 10

    NO

    YES

    COUNTER = COUNTER + 1

    Print There are, CTR_G

    End

    NUMBER > 5

    NO

    YES

    CTR_G = CTR_G + 1

    Let COUNTER counts the input number. Increment counter by 1Let CTR_G counts the input numbersgreater than 5.

  • 8/11/2019 Program Mng

    14/14

Search related