Monday, August 19, 2013

Problem 16 redo in Frink

My previous solution to problem 16 was in Python, but I would like to be able to use such a versatile language again in the future, so I decided to revisit the problem in Frink - this problem is trivial in any language that supports arbitrary-size integers, and Frink is such a language.
num = 2^1000
digisum = 0
while num > 0 
{
    digisum = digisum + (num % 10)
    num = num div 10
}
println[digisum]

No comments:

Post a Comment