We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
def square_of_sum(arr, my_proc) sum = arr.reduce(0, &my_proc)
sum ** 2
end
sum_proc = proc { |a, b| a + b } input_array = [1, 2, 3]
result = square_of_sum(input_array, sum_proc)
When run with the input array [1, 2, 3], the output will be 36.
more info here if you want more info
Thanks and visit my website.
def square_of_sum(arr, my_proc) sum = arr.reduce(0, &my_proc) sum ** 2 end sum_proc = proc { |a, b| a + b } input_array = [1, 2, 3] result = square_of_sum(input_array, sum_proc) When run with the input array [1, 2, 3], the output will be 36. more info here if you want more info
thanks and read shayari in english.
Thanks and visit my site.
def square_of_sum(arr, my_proc) sum = arr.reduce(0, &my_proc)
sum ** 2 end
sum_proc = proc { |a, b| a + b } input_array = [1, 2, 3]
result = square_of_sum(input_array, sum_proc) for more information visit this site
When run with the input array [1, 2, 3], the output will be 36.
more info here