Dynamic Sum of Array Elements

Given an array “A”, your task is to find the sum of the elements in the array.
Perform the same using 2 different methods:
Part 1: Get the size of the array, get the array elements by using an input dialog activity, and perform the sum operation.
Part 2: Get a number “N” and find the sum of the first “N” elements from the array.

1 Like

Hi @Aswin_Ramesh,
Please use a decent topic title. It should describe a little bit case of yours. “Help” is too generic.

2 Likes

Updated it :slight_smile:

2 Likes

Hey @Aswin_Ramesh

You need to do this as below, once you get the number N from the input dialog…

arrNum.Take(N).Sum()

The above statement will give you the sum of the elements until the size mentioned in the input dialog

You can use that in the assign statement & store it in a variable as well

Hope this helps

Thanks
#nK

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.