Skip to content
Exercise · Q1

Q.Write pseudocode that reads two numbers and divide one by another and display the quotient.

CBSENCERTSubjective· 2mImportance★★★★★est
42% · 15/36 Questions
✓ Free question

Input two numbers, compute num1 / num2, output the quotient — a four-line input–process–output pseudocode.

The idea. Pseudocode expresses the logic of a solution in plain structured English, free of any language's syntax. Every simple computation follows the same skeleton: input → process → output. Here the process is a single division whose result is called the quotient.

Pseudocode

DIVIDE_TWO_NUMBERS
    INPUT num1
    INPUT num2
    COMPUTE quotient = num1 / num2
    PRINT quotient
END

A safer version guards against division by zero:

DIVIDE_TWO_NUMBERS_SAFE
    INPUT num1
    INPUT num2
    IF num2 == 0 THEN
        PRINT "Division by zero is not possible"
    ELSE
        COMPUTE quotient = num1 / num2
        PRINT quotient
    END IF
END

Python verification

num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
if num2 == 0:
    print("Division by zero is not possible")
else:
    print("Quotient =", num1 / num2)

Sample run

Enter first number: 20
Enter second number: 4
Quotient = 5.0
Watch out

Forgetting the num2 == 0 check is the classic pitfall — dividing by zero is undefined and crashes a real program (ZeroDivisionError in Python).

✓Final answer

The pseudocode reads num1 and num2, computes quotient = num1 / num2, and prints the quotient — e.g. inputs 20 and 4 print 5.0.

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.