Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitscript authored Sep 22, 2022
1 parent 07fdbda commit ada0a6f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions 10Day-Exponent.sol
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 Day4 {
//Create a function power(uint x,uint y) .This power() will calculate x raised to the power of y and return it.
function power(uint256 base, uint256 exponent) public pure returns (uint256)
{
uint256 value = 1;
while (exponent != 0) {
value *= base;
--exponent;
}

return value;
}
}

0 comments on commit ada0a6f

Please sign in to comment.