Tagged: , ,

  • Palindrome

  • Akash 

    Administrator
    at

    Write a program to check if a given string is palindrome or not.

  • Akash 

    Administrator
    at

    import java.util.*;

    public class Palindrome {

    public static void main(String args[])

    {

    Scanner scan=new Scanner(System.in);

    System.out.println(“Enter the String”);

    String str=scan.nextLine();

    String rev=””;

    for(int i=str.length()-1;i>=0;i–)

    {

    rev=rev+str.charAt(i);

    }

    if(str.equals(rev))

    {

    System.out.println(“The String is palindrome”);

    }

    else

    {

    System.out.println(“The String is not palindrome”);

    }

    }

    }

  • SRIKANTH

    Member
    at

    Discuss in C language or python.

  • Prabhakaran 

    Member
    at

    Sure, we can discuss this , writing in multiple languages will help

Log in to reply.

Original Post
0 of 0 posts June 2018
Now
KodNest Training New Batch is starting on 21st September 2020. Attend one week free demo classes.Register Now

New Report

Close