mercredi 21 septembre 2016

How do I do this?

I am doing a lab but am stuck on a question and most likely im doing it wrong

This is the question:

public static boolean isPalindrome(int num)

// num is a 5 digit number

// check to see if num is a palindrome

// isPalindrome(12521) -> true

// isPalindrome(12345) -> false

This is my code:

public static boolean isPalindrome(int num)

{
    int ones = % 10;

    int tenthou = % 100000/10000;


    if (ones = tenthou);

}

What im trying to do is call on the ones digit and the first digit and do a if statement to see if the 5 digit number is a palindrome but I dont know how to start the if and ask to check

Aucun commentaire:

Enregistrer un commentaire