We have moved to www.dataGenX.net, Keep Learning with us.

Sunday, January 15, 2012

bc command : tips & tricks

bc stands for bench calculator
Here are some examples of bc command :

a) addition
$ echo '57+43' | bc 100

b) subtraction
$ echo '57-43' | bc 14

c) multiplication
$ echo '57*43' | bc 2451


scale
The scale variable determines the number of digits which follow the decimal point in your result. By default, the value of the scale variable is zero.

d) division
$ echo 'scale=25;57/43' | bc 1.3255813953488372093023255

No comments :

Post a Comment