Check if the number is positive or negative or zero
Aim: Implement a program to check if
the number is positive or negative or zero
Algorithm:
1.Start
2. Read Num
3.Is Num > 0
4.Print “Positive”
5.Else if Num<0
6.Print “Negative”
7.Else Print “Zero
8.Stop
Program:
num
= float(input("Enter a number: "))
if
num > 0:
print("Positive number")
elif
num == 0:
print("Zero")
else:
print("Negative number")
Output :
Enter a number: 2
Positive number
0 Comments:
Post a Comment