利用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

猜你喜欢

转载自blog.csdn.net/2302_77339802/article/details/134840470