Answer to Question #255985 in UNIX/Linux Programming for Man

Question #255985
Write a script to find if a number is positive or negative or zero. Hint (num=0 ---zero) (Num<0 --- negative) ( num >0 --- postive)
1
Expert's answer
2021-10-24T18:32:23-0400
#!/bin/bash

echo "Input number";
read number;

if (( number > 0)); then
    echo "Positive";
elif (( number < 0)); then
    echo "Negative";
else
    echo "Zero";
fi

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS