268,768 views
27 votes
27 votes
Write an algorithm to find given number is “Positive” or “Negative” using a selection structure

User Shubham R
by
2.8k points

1 Answer

8 votes
8 votes

Answer:

Step 1: Start

Step 2: Read number x

Step 3: if (x < 0) then

Step 4: Display "Given number is Negative"

Step 5: else

Step 6: Display "Given number is Positive"

Step 7: Stop

Step-by-step explanation:

On step 2, a number will be entered and stored in x, on step 3 an if statement which is a selection statement is used to check if the value stored in x is less than 0, if it is, step 4 is executed which displays that the number entered is Negative. But if the selection statement on step 3 is false, step 6 is executed which displays that the number entered is Positive.

User Simonwjackson
by
2.9k points