Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # e^x = 1 + x + x^2/2! + x^3/3! + x^4/4! + ...x^n/n!
- t=1.0
- s=1.0
- x=0
- n=0
- echo "Digite o valor para X (e^x): "
- read -r x
- echo "Digite o valor de precisao (sequencias que serao feitas): "
- read -r n
- for (( i=1; i<=$n; i++ ))
- do
- t1=$(echo "$t/$i" | bc -l)
- t=$(echo "$t1*$x" | bc -l)
- s=$(echo "$s+$t" | bc -l)
- done
- echo "$s" | bc -l
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement