pragma solidity ^0.4.17;
contract BasicCal {
bytes1 a = 0xb5;
bytes1 b = 0x56;
bytes1 eg1 = and(a,b);
bytes1 eg2 = or(a,b);
bytes1 eg3 = xor(a,b);
bytes1 eq4 = not(a,b);
function and(bytes1 a, bytes1 b) returns(bytes1){
return a&b;
}
function or(bytes1 a, bytes1 b) returns(bytes1){
return a|b;
}
function xor(bytes1 a, bytes1 b) returns(bytes1){
return a^b;
}
function not(bytes1 a, bytes1 b) returns(bytes1){
return a&b;
}
}
pragma solidity ^0.4.17;
contract AdvCalculator {
// Result of the operation are always stored in this variable
uint result=10;
function Calculator() public {
// constructor
}
// returns the result
function getResult() public view returns (uint) {
return result;
}
// result = result + num
function addToNumber(uint num) public {
result += num;
}
// result = result - num
function substractNumber(uint num) public {
result -= num;
}
// result = result * num
function multiplyWithNumber(uint num) public {
result *= num;
}
// result = result / num
function divideByNumber(uint num) public {
result /= num;
}
}