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
How to check if the previous command was run successfully?
What is sed in shell script?
i have 2 tables 4 colums table 1 respective values a1 6, a2 8,a3 9,a4 14 & table 2 respective values a1 6, a2 8, a3 9, a4 12. if compare 2 tables 3 colums values same then 4th column values 1)Qes diff >5 then (5 * diff value ) 2)Qes diff <5 the 5 3)Qes diff 5 then 5 print respective values..
What are the four fundamental components of every file system on linux?
What is a shell script? Can you name some of its advantages?
What is wc in shell script?
How do I run a bin bash script?
How to pass an argument to a script?
How do I run a shell script on a mac?
How many fields are present in a crontab file and what does each field specify?
What is a program shell?
How does shell scripting work?
How are shells born?
What is scripting autism?
What exactly is a shell?