shell习题-shell中的小数


题目如下:

a=0.5  b=3  c=a*b   求c的值

 

参考答案

#!/bin/bash
a=0.5
b=3
c=`echo "scale=1;$a*$b"|bc`
echo $c