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


Please Help Members By Posting Answers For Below Questions

What is another name for a bash shell script that you might see?

1017


c program which behaves like a shell(command interpreter). it has its own prompt say "NewShell$".any normal shell command is executed from your shell by starting a child process to execute a system program corrosponding to the command

4694


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..

1794


How do I run a bin bash script?

580


What does $$ mean in shell script?

591






Can shell script run on windows?

570


What is shell chemistry?

542


What is a shell environment?

577


How do I stop script errors?

578


Explain how you Automate your application using Shell scripting.

1854


Explain about "s" permission bit in a file?

618


Is cmd a shell?

598


What is the significance of the shebang line in shell scripting?

534


How do I open a jshell in cmd?

602


Explain about login shell?

637