hamburger menu
All Coursesall course arrow
adda247
reward-icon
adda247
    arrow
    arrow
    arrow
    Observe the following flowchart and find the output.
    Question

    Observe the following flowchart and find the output.

    A.

    180

    B.

    120

    C.

    100

    D.

    160

    Correct option is D


    To analyze the flowchart and determine the output, let's break it down step by step:
    1. Initialization:
    · A = 100
    · S = 0
    2. Condition Check (A > 20):
    · Initially, A = 100, so the condition A > 20 is True.
    3. First Iteration:
    · Since A > 20 is True, we proceed to:
    · S += A → S = 0 + 100 = 100
    · A -= 40 → A = 100 - 40 = 60
    4. Second Iteration:
    · Now, A = 60, and we check A > 20 again.
    · A = 60 is still greater than 20, so:
    · S += A → S = 100 + 60 = 160
    · A -= 40 → A = 60 - 40 = 20
    5. Third Iteration:
    · Now, A = 20, and we check A > 20.
    · A = 20 is not greater than 20, so the loop ends here.
    6. Output:
    · The final value of S is 160.
    Thus, the output is:
    S = 160

    Free Tests

    Free
    Must Attempt

    CDP Subject Test 01

    languageIcon English
    • pdpQsnIcon20 Questions
    • pdpsheetsIcon20 Marks
    • timerIcon20 Mins
    languageIcon English
    Free
    Must Attempt

    EVS Subject Test 01

    languageIcon English
    • pdpQsnIcon20 Questions
    • pdpsheetsIcon20 Marks
    • timerIcon20 Mins
    languageIcon English
    Free
    Must Attempt

    CTET Paper-I PYP (07 July 2024)

    languageIcon English
    • pdpQsnIcon150 Questions
    • pdpsheetsIcon150 Marks
    • timerIcon150 Mins
    languageIcon English
    test-prime-package

    Access ‘EMRS PGT’ Mock Tests with

    • 60000+ Mocks and Previous Year Papers
    • Unlimited Re-Attempts
    • Personalised Report Card
    • 500% Refund on Final Selection
    • Largest Community
    students-icon
    289k+ students have already unlocked exclusive benefits with Test Prime!
    Our Plans
    Monthsup-arrow