Write a code to check a palindrome.
Code to check if a given string is a palindrome or not.
Remove all non-alphanumeric characters from the string
Convert the string to lowercase
Reverse the string and compare with the original string
If th...read more
# Take user input
user_input = input('Enter a character or number: ')
# Reverse the input
reversed_input = user_input[-1::-1]
# Check for palindrome
if user_input == reversed_input:
print('It is a palindro...read more
import java.util.*;
class PalindromeExample2
{
public static void main(String args[])
{
String original, reverse = ""; // Objects of String class
Scanner in = new Scanner(System.in);
System.out.println("Enter a string/number to check if it is a palindrome");
original = in.nextLine();
int length = original.length();
for ( int i = length - 1; i >= 0; i-- )
reverse = reverse + original.charAt(i);
if (original.equals(reverse))
System.out.println("Entered string/number is a palindrome.");
else
System.out.println("Entered string/number isn't a palindrome.");
}
}
#include<stdio.h>
int main(){
int a, temp;
scanf("%d",&a);
temp=a;
int rev=0;
while(a>0){
rev=(rev*10)+(a%10);
a=a/10;
}
if(rev==temp){
printf("palindrome");
}
else{
printf("Not a palindrome");
}
retur...read more
#include<stdio.h>
int main(){
int a, temp;
scanf("%d",&a);
temp=a;
int rev=0;
while(a>0){
rev=(rev*10)+(a%10);
a=a/10;
}
if(rev==temp){
printf("palindrome");
}
else{
printf("Not a palindrome");
}
retur...read more
#include<stdio.h>
int main(){
int a, temp;
scanf("%d",&a);
temp=a;
int rev=0;
while(a>0){
rev=(rev*10)+(a%10);
a=a/10;
}
if(rev==temp){
printf("palindrome");
}
else{
printf("Not a palindrome");
}
retur...read more
Class palindrome number {
Public Static void main (String []args)
{
int No=123,rev=0,rem,temp=No;
While(No>0)
{
rem=No%10;
rev=rev*10+rem;
No=No/10;
}
If(temp==rev)
System.out.println("Palindrome number");
Else
Sy...read more
Top EY Global Delivery Services ( EY GDS) Technology Consultant interview questions & answers
Popular interview questions of Technology Consultant
Top HR questions asked in EY Global Delivery Services ( EY GDS) Technology Consultant
Reviews
Interviews
Salaries
Users/Month