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
What is B2B?
What should a junior java developer know?
What is j2ee product?
What is multi tier architecture in j2ee?
Is tomcat a java ee?
What is a thin client?
What is a component in java?
What are the components of awt in java?
What is a java ee container?
What do you understand by connector?
What is the latest technology used in java?
What is server in j2ee?
Is java a tool?
What do you understand by actionform?
What is java servlet container?