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 is the meaning of $1 in shell script?
Explain about debugging?
What is a boot block?
How to debug the problems encountered in the shell script/program?
What are zombie processes?
How can you get the value of pi till a 100 decimal places?
Why is it called a shell?
What are different types of shell?
Explain about sourcing commands?
What is shift command in shell script?
What is the first line of a shell script called?
How will you find the 99th line of a file using only tail and head command?
What is shell scripting?
How do I open a jshell in cmd?
Using set -A write a script to print the output of the ls command in 5 columns with two spaces between each column. Pretend that ls does not have multicolumn output.