Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Sum of List Elements
- void main()
- {
- List<int> list1 = [1,2,3,4,5];
- print(sumList(list1));
- }
- int sumList(List<int> list1)
- {
- int sum=0;
- for(int i=0;i<list1.length;i++)
- {
- sum=sum+list1[i];
- }
- return sum;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement