Friday, August 10, 2012

Palindrome


Palindrome
Output
Number is palindrome!

Source code
Palindrome.java

package com.swain.cell;

public class Palindrome {

       public static void main(String [] args){
                try{
               
                int num= 161;
                int n = num;
                int rev=0;
                for (int i=0; i<=num; i++){
                int r=num%10;
                num=num/10;
                rev=rev*10+r;
                i=0;
                }
                 if(n == rev){
                System.out.print("Number is palindrome!");
                }
                else{
                System.out.println("Number is not palindrome!");
                }
                }
                catch(Exception e){
                System.out.println("Error");
                }
                }
}


Java Quick Program

1. Write a Code to generate Random numbers public class GenerateRandomNumbers { public static void main(String[] args) { System.out...