2 "A number is said to be palindrome il it appears to be the same after
reversing it's digits"". Write a program by using a class with the following
specifications:
class : Number
data members : private int num;
number (int x) : constructor to initialive num with x:
int reverse (int n): used to retum the reverse or number
void palindromeo: to check and print whether the number is palindrome
or not
pls help
will mark u brainliest whose with write answer
otherwise will ur answer if u spam
Attachments:
Answers
Answered by
0
public class Number {
private int num;
Number(int x) {
num = x;
}
int reverse(int n) {
return Integer.parseInt(new StringBuffer(n + "").reverse( ).toString( ));
}
void palindrome( ) {
System.out.printf("It is%sa Palindrome.", (num = = reverse(num)) ? " " : " not ");
}
}
Answered by
0
Answer:
please give me the program answer
Similar questions
English,
4 months ago
Political Science,
9 months ago
English,
9 months ago
Business Studies,
1 year ago