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 home handle?
What is mean by connection pooling?
What is j2ee application?
How do I become an expert in java?
Which is latest technology in java?
What is enterprise information system?
What is fatal error?
What is jradiobutton in java?
What is a jpanel in java?
What are the differences between Ear, Jar and War files? Under what circumstances should we use each one?
J2ee is a container centric architecture. Explain.
Is j2ee a programming language?
What is java api for xml registries (jaxr)?
Explain the j2ee tiers.
What does enterprise javabeans module contain?