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 / srikanth

import java.io.*;
class palin{
public static void main(String as[]){
try{
InputStreamReader isr=null;
BufferedReader br=null;
br=new BufferedReader(new InputStreamReader(System.in));
int num=Integer.parseInt(br.readLine());
System.out.println(num);
int n=num;
int rev=0;
System.out.println("number");
System.out.println(num);
for(int i=0;i<=num;i++){
int r=num%10;
num=num/10;
rev=rev*10+r;
i=0;
}
System.out.println("after reversing"+rev);
if(n==rev){
System.out.println("number is palic");
}
else{

System.out.println("number is not palic");
}
}catch(Exception e){
System.out.println(e);
}
}
}

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is urn?

870


What is the description for expression element?

955


What is pure java?

958


What is java ee sdk?

847


What is use of final keyword in java?

921


How java is used in web applications?

885


What do you understand by j2ee?

909


Where can I find java developers?

877


Is object a composite data type in java?

873


What is the build file?

881


Is java a tool?

876


What is java 2 platform, micro edition (j2me)?

1005


What is application client module?

933


What is jaap?

914


What is home handle?

906