write an algorithm that will accept a number and display if the number is positive or negative
Answers
Answered by
3
Answer:
Start
Input a number
check if no. is greater than 0
if yes display "positive"
else display "negative"
Stop
Answered by
2
Question:-
Write an algorithm that will accept a number and display if the number is positive or negative.
Answer:-
Here is your answer.
STEP 1: START
STEP 2: Accept a number,say N.
STEP 3: If N is greater than 0 then display that "Number is positive. " else display that "Number is Negative. "
STEP 4: STOP
Sample program in Python,
n=int(input("Enter an integer: "))
if n>0:
print("Number ",n, " is positive.")
elif n==0:
print("It's Zero..")
else:
print("Number ",n, " is negative. ")
Similar questions