Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is home handle?

907


What is mean by connection pooling?

946


What is j2ee application?

920


How do I become an expert in java?

900


Which is latest technology in java?

884


What is enterprise information system?

920


What is fatal error?

962


What is jradiobutton in java?

870


What is a jpanel in java?

855


What are the differences between Ear, Jar and War files? Under what circumstances should we use each one?

932


J2ee is a container centric architecture. Explain.

871


Is j2ee a programming language?

897


What is java api for xml registries (jaxr)?

971


Explain the j2ee tiers.

819


What does enterprise javabeans module contain?

865