Algorithm to find the number is positive, negative or zero
Answers
Answered by
8
Question:-
Write an algorithm to find whether a number is positive, negative or zero.
Solution:-
Algorithm:-
STEP 1: START
STEP 2: Enter a number, say N
STEP 3: If N is greater than 0 then display the message that "Number is Positive."
STEP 4: If N is less than 0 then display the message that "Number is Negative" otherwise display that "It's zero. "
STEP 5: STOP
Sample program in Python
n=int(input("Enter the number: "))
if n>0:
print("Number is positive. ")
elif n<0:
print("Number is negative.")
else:
print("It's Zero. ")
Similar questions
Science,
3 months ago
English,
3 months ago
Computer Science,
6 months ago
English,
6 months ago
Chemistry,
11 months ago