Question: In java Write a program that prompts the user to enter a four-digit integer and determines whether it is a palindrome number. A number is

In java

Write a program that prompts the user to enter a four-digit integer and determines whether it is a palindrome number. A number is palindrome if it reads the same from right to left and from left to right. */ ex: 1221 is a palindrome because 1221 backwards is still 1221.??????

write a code similar to this except the one below determines if a 3 digit interger is a plaindrome.

import java.util.Scanner; public class Chapter3Ass12 { public static void main(String[] args){ Scanner input = new Scanner(System.in);

int number; int number1; int numberRemain; int number2; System.out.print("Enter a three-digit integer: "); number = input.nextInt();

number1 = (int)(number / 100); numberRemain = number % 100; number2 = (int)(numberRemain % 10);

System.out.println( number + ((number1 == number2) ? " is a " : " is not a ") + "palindrome"); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!