Computers and Technology

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;

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 12:30, kayleigh2037
What characteristic of long period comets suggest they come directly from the oort cloud?
Answers: 2
image
Computers and Technology, 22.06.2019 13:30, 21megoplin
In which phase does software coding and testing happen in the spiral model? the spiral model does not have a separate testing phase. both, software coding and testing occurs during the phase.
Answers: 3
image
Computers and Technology, 22.06.2019 19:30, mitalichavez1
When creating a presentation in libre office impress, where does the editing of slides take place? a. the slides panel b. the center panel c. the tasks panel, under the masters pages tab d. the tasks panel, under the layouts tab
Answers: 3
image
Computers and Technology, 23.06.2019 08:00, Buddy01
Match the items with their respective descriptions.
Answers: 1
Do you know the correct answer?
Implement a Java program using simple console input & output and logical control structures such...

Questions in other subjects:

Konu
Mathematics, 10.07.2019 10:30
Konu
Mathematics, 10.07.2019 10:30
Konu
Mathematics, 10.07.2019 10:30