Date created: 07/10/11 19:30:11. Last modified: 08/06/16 22:10:41

Problem 20

#!/bin/bash
# Project Euler - Problem 20
j=1

for ((i=100;i>=1;i--))
do
	j=`echo "$j * $i" | bc`
done
echo $j > ./tmp

final=0
while IFS= read -n 1 char
do
	if (($char -ne " "))
	then
		final="$final+$char"
	fi

done < ./tmp
rm ./tmp
echo $final | bc

Previous page: Problem 16
Next page: --Python Notes--