“ist Palindrome Java” Code-Antworten

Ganzzahl Palindrome in Java

 public boolean isPalindrome(int x) {
        String str = Integer.toString(x);
        String reverse =  new StringBuilder(str).reverse().toString();
        return  str.equals(reverse)?true:false;}
Kirk-Patrick Brown

ist Palindrome Java

public static boolean checkPalindrome(String str)
{     
 
    int len = str.length();

    for(int i = 0; i < len / 2; i++)  {
        if (str.charAt(i) != str.charAt(len - i - 1))
            return false;
    }
    return true;
}
Filthy Fox

Palindrome in Java

package com.candidjava; import java.util.Scanner; public class PalindromeUptoN{	public static void main(String[] args)	{		int n, b, rev = 0;		Scanner sc = new Scanner(System.in);		System.out.println("Enter the Palindrome No N:");		int N = sc.nextInt();		System.out.print("Palindrome numbers from 1 to N:");		for (int i = 1; i <= N; i++)		{			n = i;			while (n > 0)			{				b = n % 10;				rev = rev * 10 + b;				n = n / 10;			}			if (rev == i)			{				System.out.print(i + " ");			}			rev = 0;		}	} }
sree_007

Ähnliche Antworten wie “ist Palindrome Java”

Fragen ähnlich wie “ist Palindrome Java”

Weitere verwandte Antworten zu “ist Palindrome Java” auf Java

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen