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=0
- x=0
- n=0
- read -r x
- read -r n
- s=t
- for i in {1..n}
- do
- t=$(( )) # t = (t / j) * x
- s=$((s + t)) # s = s + t
- done
- echo "$s" | bc -l
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement