Date created: Sunday, July 10, 2011 7:30:11 PM. Last modified: Saturday, August 6, 2016 10:10:41 PM

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--