To evaluate expressions involving decimal places (floating points) "bc -l" is very useful. Your task is to evaluate the expression and display the output correct to decimal places. Shell script is as below:

#!/bin/bash
read expression
printf "%.3f\n" $(echo "scale=10;$expression" | bc -l)

input:

23 + 12*(34 - 45) + 67/3


output:

-86.667

Read it on hackerrank.com