WAP to input a number check and print whether the number is palindrome or not.Using java modular programming
Answers
Answered by
4
Answer:
this is the program
please mark as brainiest!!
Attachments:
Answered by
1
Answer:
import java.util.*;
class Palindrome
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("enter a number");
int num=sc.nextInt();
int reversedno = 0, remainder, originalno;
originalno = num;
while( num != 0 )
{
remainder = num % 10;
reversedno = reversedno * 10 + remainder;
num /= 10;
}
if (originalno == reversedno)
System.out.println(originalno + " is a palindrome.");
else
System.out.println(originalno + " is not a palindrome.");
}
}
hope it helped
Explanation:
Similar questions
Social Sciences,
6 months ago
English,
6 months ago
English,
6 months ago
Social Sciences,
1 year ago
English,
1 year ago
History,
1 year ago