利用solidity语言进行加减乘除计算

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract test2 {
    function performOperations(int256 a, int256 b) external pure returns (int256, int256, int256, int256, int256) {
        int256 sum = a + b;
        int256 difference = a - b;
        int256 product = a * b;
        int256 quotient = a / b;
        int256 remainder = a % b;

        return (sum, difference, product, quotient, remainder);
    }
}

 运行很简单,输入两位数,然后点击call

利用solidity语言进行加减乘除计算_第1张图片

你可能感兴趣的:(solidity例子,智能合约)