Write a shell program to test whether a given number is even
or odd?
Answer Posted / mani
echo "Enter the Number"
read a
b=`echo "$a % 2"|bc`
if [ $b -eq 0 ]
then
echo "Given Number is Even "
exit
fi
echo " Given Number is odd"
| Is This Answer Correct ? | 67 Yes | 34 No |
Post New Answer View All Answers
What is the significance of $#?
What is shell scripting used for?
How to get script name inside a script?
Is shell scripting easy to learn?
What are the advantages of shell scripting?
What is a file basename?
What is $1 in shell scripting?
What language is bash?
What are script files?
How do I run a .sh file?
What are the different communication commands available in the shell?
How to get the 3rd element/column from each line from a file?
Where is bash history?
Why are there shells on the beach?
how to get part of string variable with echo command only?