We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
read-p"Enter the expression: "expprintf"%.3f"$(echo$exp|bc-l)
where 1st line will take the expression, and
2nd line will read the expression using echo $exp, perform the calculations using bc -l and print the result upto 3 decimal places using printf "%.3f"
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Arithmetic Operations
You are viewing a single comment's thread. Return to all comments →
where 1st line will take the expression, and 2nd line will read the expression using echo $exp, perform the calculations using bc -l and print the result upto 3 decimal places using printf "%.3f"