Unverified Commit 2062b261 authored by Lokesh Singh's avatar Lokesh Singh Committed by GitHub

Create Java Program to Reverse a Number

parent 7bbca53d
class HelloWorld {
public static void main(String[] args) {
int n = 12345, res = 0;
while(n!=0)
{
int digit = n%10;
res = res*10 + digit;
n = n/10;
}
System.out.println(res);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment