Write a shell program to test whether a given number is even
or odd?
Answer Posted / fariha
echo -n "Enter numnber : "
read n
rem=$(( $n % 2 ))
if [ $rem -eq 0 ]
then
echo "$n is even number"
else
echo "$n is odd number"
fi
| Is This Answer Correct ? | 240 Yes | 73 No |
Post New Answer View All Answers
What are script files?
Which is better perl or shell scripting?
What is shell scripting?
What is the equivalent of a file shortcut that we have a window on a linux system?
How do you know which shell I am using?
What is bash command used for?
What are zombie processes?
Is it possible to substitute "ls" command in the place of "echo" command?
What is k shell?
How many fields are present in a crontab file and what does each field specify?
How will you connect to a database server from linux?
How to print all array elements and their respective indexes?
Write down the syntax of "for " loop
Explain about the slow execution speed of shells?
What is the purpose of scripting?