Data Structures and Algorithm

Runtime
java 21.0.12
Files
22 files · 16 KB
Runs
50 runs
Published
numberSystem/ReverseNumber.java375 B
package numberSystem;​public class ReverseNumber {    public static void main(String[] args) {        int n = 1234;        int r = reverse(n);        System.out.println(r);    }​    static int reverse(int n) {        int r = 0;        while (n != 0) {            int ld = n%10;            r = r * 10 + ld;            n = n/10;        }        return r;    }}​