Write a program to display numeric value in reverse order.
Ex: I have given a number like 7584, It should display in
reverse order like 4857.
Answer Posted / selvi
import java.util.Scanner;
public class IntReverseOrder
{
public static void main(String args[])
{
Scanner scan = new Scanner(System.in);
int num = scan.nextInt();
StringBuffer sb = new StringBuffer();
int remainder;
while(num>0)
{
remainder = num%10;
sb = sb.append(remainder);
num = num/10;
}
System.out.println("Reverse Order = "+sb);
}
}
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
J2ee is a container centric architecture. Explain.
What does the web module contain?
How will you explain load() and get() methods?
Describe secure socket layer (ssl)?
How do I become an expert in java?
Difference between load and get method?
How many types of constructors are there in java?
What is iso 3166?
Is java procedural or object oriented?
What is general entity?
What is Document Object Model?
What is jta and jts?
What is setfocusable in java?
What is meant by applet in java?
what is direct link to download swing ebook,applet,ejb,core java