Skip to content

Instantly share code, notes, and snippets.

@BogdanHabic
Created November 29, 2018 19:01
Show Gist options
  • Save BogdanHabic/346e178239e980c74a0a05db7df19d75 to your computer and use it in GitHub Desktop.
Save BogdanHabic/346e178239e980c74a0a05db7df19d75 to your computer and use it in GitHub Desktop.
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