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
Why is java considered dynamic?
What is data?
What is Document Object Model?
What is the latest technology used in java?
What is java used for in technology?
Why java is not 100% object oriented language?
What is attribute what is asant?
Why awt is used in java?
Are java primitives objects?
Describe orm?
Difference between load and get method?
What is j2ee api?
What is java application server?
Why is java called technology?
What is the best java application server?