Showing posts with label Palindrome. Show all posts
Showing posts with label Palindrome. Show all posts

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");
                }
                }
}


How ChatGPT can Benefit Coding: Your Guide to Leveraging an AI Language Model

 Introduction: Hello, coders! Welcome to this blog post on how ChatGPT, an AI language model, can benefit your coding skills and projects. A...