# Fix the 'max=10' to fit what you need as maximun iterations count.
def lukas_loop(num1, num2)
max = 10 # I didn't understand how you calculated the max
iteractions counting.
1.upto(max) do |n|
op = ((num1 % (10**(n+1))) / 10**n )
result = op*num2
puts "#{result}"
end
end
Is it something like this?
···
On Sat, Oct 26, 2013 at 10:41 PM, Harry Kakueki <list.push@gmail.com> wrote:
So that every time it puts in the zero like the example, but also
outputs the result. for the number of times the loop will happen i will
be using
# Fix the 'max=10' to fit what you need as maximun iterations count.
def lukas_loop(num1, num2)
max = 10 # I didn't understand how you calculated the max
iteractions counting.
1.upto(max) do |n|
op = ((num1 % (10**(n+1))) / 10**n )
result = op*num2
puts "#{result}"
end
end
Is it something like this?
Ok you guys get the idea, but i need it to output every single time it
does the loop will the example you gave do that ?
Also i will be calculating the amount it loops by the .length of "num1"
so that it cycles through each of the digits and then multiplies each of
the digits by num2