How to do math operations in android shell? To do math operations in Linux shell, bc language can be used. For example,

echo `echo "scale=4;sqrt(400)"|bc -l`


This will give output of 20.0000

Unfortunately bc is not available on android. My question is,

1) How do I do math operations in android shell?

2) If bc has to be used, then, how to install it in android?

It is good enough for me if I can do integer calculations, I don't really need floating point or arbitrary precision results.
BusyBox doesn't include bc, but it does include the Reverse Polish Notation calculator dc.  Since Busybox can be installed from several installers on Google Play, this is probably the easiest way to get a command-line-based calculator on Android.

Alternatively, I've heard that bc can be compiled for Android quite easily using the Android NDK, so if you're comfortable with compiling software you could do this.