Created
November 29, 2018 19:01
-
-
Save BogdanHabic/346e178239e980c74a0a05db7df19d75 to your computer and use it in GitHub Desktop.
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
pragma solidity ^0.4.24; | |
contract Calculator { | |
uint c; | |
function add(uint a, uint b) public { | |
c = a + b; | |
} | |
function sub(uint a, uint b) public { | |
c = a - b; | |
} | |
function mul(uint a, uint b) public { | |
c = a * b; | |
} | |
function div(uint a, uint b) public { | |
require(b > 0, "The second parameter should be larger than 0"); | |
c = a / b; | |
} | |
function getResult() public view returns (uint x) { | |
return c; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment