-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
13896b9
commit 45c2aa8
Showing
1 changed file
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >=0.5.0 <0.9.0; | ||
|
||
contract Day6 { | ||
//Create a function sumarray(array, length of array) .This sumarray() will take two arguments - a dynamic int type array and length of the array. | ||
function sumarray(int256[] memory arr, uint256 size) | ||
public | ||
pure | ||
returns (int256) | ||
{ | ||
int256 sum = 0; | ||
for (uint256 i = 0; i < size; i++) { | ||
sum += arr[i]; | ||
} | ||
return sum; | ||
} | ||
} |