Arithmetic Operations

Sort by

recency

|

249 Discussions

|

  • + 0 comments

    !/bin/bash

    read a result=a"|bc -l) echo $result | xargs printf '%.3f\n'

  • + 0 comments

    !/bin/bash

    read -r expr

    value=expr" | bc -l)

    printf "%.3f\n" "$value"

  • + 1 comment

    read exprr; echo " scale = 3; $exprr " | bc -l

    I wrote this, but only testcase is failing my output is 17.928 expcted output is 17.929

    Can anyone help me with this?

  • + 0 comments

    read x

    result=x" | bc -l | xargs printf '%.3f')
    echo "$result"

  • + 0 comments
    read x
    
    awk "BEGIN { printf \"%.3f\n\", $x }"