Write a program to check if a string or integer is palindrome or not? write the output For a Given multiple inheritance program? write the output for a given method overriding program?

AnswerBot
1y

Programs to check palindrome and output for multiple inheritance and method overriding

  • Palindrome program can be implemented using string or integer reversal and comparison

  • Output for multiple inheritan...read more

sohilh483 Hussain
1y

public class Palindrome {

public static boolean isPalindrome(String str) {

for (int i = 0; i < str.length() / 2; i++) {

int n = str.length();

if (str.charAt(i) != str.charAt(n - 1 - i)) {

// not a palondro...read more

Prakash cse
1y

class Main{

public static void main(String[] args) {

Scanner scan=new Scanner(System.in);

String s=scan.nextLine();

boolean b=true;

for(int i=0,j=s.length()-1;i<=j;i++,j--)

{

if(s.charAt(i)==s.charAt(j))

continue;

else

{

b=false;

break;

}

}

if(b)

System.out.print("Its Palindrome");

else

System.out.print("Not a Palindrome");

}

}

Anonymous
1y

public class Palindrome {

public static boolean isPalindrome(String str) {

for (int i = 0; i < str.length() / 2; i++) {

int n = str.length();

if (str.charAt(i) != str.charAt(n - 1 - i)) {

// not a pal...read more

Anonymous
1y

//Program for palindrome

import java.util.Scanner;

class Palindrome

{

public static void main(Strong[] args)

{

Scanner input: new Scanner(System.in);

int num,Rev=0,Rem,I=0;

num = nextInt();

temp=num;

while(temp!=0)

{

rem=temp%10;

rev=rev*10+rem;

temp=temp/10;

}

if(rev==num)

{

System.out.println(rev+" is palindrome);

}

else

{

System.out.println(rev+" is not palindrome");

}

}

}

Supriya
1y

Class palindrome{

public static void main(String [ ] args) {

int n=121;

int temp=n;

int rem=0;

int sum=0;

while(n>0)

{

rem=n%10;

sum=sum*10+rem;

n=n/10;

}

if(temp==sum){

"It is a palindrome";

}

else{

"It is not a pal...read more

Anonymous
1y

def is_palindrome(value):

# Convert the value to a string for consistent comparison

value = str(value)

# Check if the reversed value is equal to the original value

if value == value[::-1]:

return Tru...read more

Add answer anonymously...
EPAM Systems Senior QA Automation Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter