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 are the components of j2ee?
Give some advantages of orm (object-relational mapping)?
Differentiate between .ear, .jar and .war files.
for example we are login into the irctc server from there it will go to the selected bank and deduct amount and come back to the irctc. so if we are developing this in java means will it be run on the same session. but as per my knowledge bank is separate and irctc is separate URL's so it will use two different sessions then how it is maintaining same session through out application and even it uses the payment gateway? how it is working can any one help me on that??
What is considered as a web component?
what is meant by proxy server
How is java development environment setup?
What is jaap?
How java is reliable?
What is element?
What is j2ee architecture?
What is the use of method save()?
What is j2ee api?
What is java mobile?
What is ejb container provider?