Question #24572

Use the top-down modular and pseudo code to design a program. Input a number entered by the user and display "Positive" if it is greater than zero, "Negative" if it is less than zero, and "Zero" if it is equal to zero.

Expert's answer

function InputNumber : integer

procedure WriteLine(line : string)

procedure CheckTheNumber(number : integer)

begin

if (number == 0)

WriteLine("Zero")

elif (number > 0)

WriteLine("Positive")

else

WriteLine("Negative")

end

program Main

integer a

begin

a = InputNumber()

CheckTheNumber(number)

end

procedure WriteLine(line : string)

procedure CheckTheNumber(number : integer)

begin

if (number == 0)

WriteLine("Zero")

elif (number > 0)

WriteLine("Positive")

else

WriteLine("Negative")

end

program Main

integer a

begin

a = InputNumber()

CheckTheNumber(number)

end

## Comments

## Leave a comment