codedamn

X raised to Y

Created by Kshitij about a year ago

0

No description provided

3 Comments

    0
    // SPDX-License-Identifier: MIT
    pragma solidity >=0.5.0 <0.9.0;
    
    contract Day4 {
       function power(uint256 base, uint256 exponent)
            public
            pure
            returns (uint256)
        {
            uint256 value = 1;
            while (exponent != 0) {
                value *= base;
                --exponent;
            }
            return value;
        }
    }
    

    whats wrong with this code

    @sivajisj

    Sivaji gadidala

    @sivajisj

    0

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

    contract power{ function powers(uint _x,uint _y) public pure returns(uint) { return _x ** _y; }

    } this is correct code i tested on remix ,why this is not accepting

    @harshshukla

    Harsh Shukla

    @harshshukla

    0

    thx for fixing the error but still mine code is not able to pass test case. i also copied exact verified solution that also fail the test case . pls look into this matter I'm stuck from 4 days . verified soln pragma solidity >=0.5.0 <0.9.0;

    contract Day4 { function power(uint256 base, uint256 exponent) public pure returns (uint256) { uint256 value = 1; while (exponent != 0) { value *= base; --exponent; } return value; } } not able to pass testcase

    @harshshukla

    Harsh Shukla

    @harshshukla

Your comment