subject

Implement a Java program using simple console input & output and logical control structures such that the program prompts the user to enter a 5 digit integer as input and does the following tasksThe program checks whether the input number is a palindrome or not and prints the result of this palindrome check. A number is a palindrome if it reads the same backward as forward. For example, each of the following five-digit integers is a palindrome: 12321, 55555, 45554 and 11611; whereas 12312, 55565, 45545 and 11621 are not a palindrome. Your program should print "The number is palindrome" or "The number is not palindrome" after checking the input number. The program checks whether the input number has 5 digits or not and prints the error message "Invalid number" if the input number is not a 5 digit one. I posted my code below, I think I have a good start with reversing the number but I'm not sure how to implement the portion of how to actually check if it is a palindrome. import java. util. Scanner;public class Problem2 { public static void main(String[] args) { int number;Scanner scanner = new Scanner(System. in);System. out. println("Enter a positive integer between 1 and 5 digits long that you would like to test for a palindrome: ");num = in. nextInt();for( ;num != 0; ){reversenum = reversenum * 10;reversenum = reversenum + num%10;num = num/10;} } }

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 21:00
You should hand write your references on your resume.
Answers: 1
question
Computers and Technology, 22.06.2019 23:00
In which part of a professional email should you try to be brief, but highly descriptive?
Answers: 1
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. what does it indicate when a website displays https instead of http? a. the website is secure. b. there is no secure sockets layer. c. the secure sockets layer is hidden. d. the website is not secure.
Answers: 1
question
Computers and Technology, 23.06.2019 17:00
The camera still is bad even with the new iphone xr and especially in low light it is even worst because you can see the pixels more if its in low light. if all you apple customers want apple to fix this then lets fill there feedback with complaints about the
Answers: 1
You know the right answer?
Implement a Java program using simple console input & output and logical control structures such...
Questions
question
Business, 04.03.2021 18:50
question
Mathematics, 04.03.2021 18:50
question
Mathematics, 04.03.2021 18:50
question
Mathematics, 04.03.2021 18:50
question
World Languages, 04.03.2021 18:50
question
Mathematics, 04.03.2021 18:50
question
Social Studies, 04.03.2021 18:50
Questions on the website: 13722363