Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitscript authored Sep 24, 2022
1 parent 239b62a commit 57f6392
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions 12Day-ReverseArray.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <0.9.0;

contract Day6 {
//Create a function reverseDigit(uint n) . This reverseDigit() will do the reversal of the number n.
function reverseDigit(uint256 n) public pure returns (uint256) {
uint256 reverse = 0;
uint256 remainder;

while (n != 0) {
remainder = n % 10;
reverse = reverse * 10 + remainder;
n /= 10;
}
return reverse;
}
}

0 comments on commit 57f6392

Please sign in to comment.