import java.io.*;
public class chuva
{
public static void main(String[] args) throws Exception
{
BufferedReader x = new BufferedReader(new InputStreamReader(System.in));
int rem, quo, rev=0;
System.out.println("Enter a number: ");
int a = Integer.parseInt(x.readLine());
int b=a;
for(int ctr=0; ctr<=a; ctr++)
{
rem = a%10;
a = a/10;
rev = rev*10 +rem;
ctr=0;
}
System.out.println(+rev);
if(b==rev)
System.out.println("Palindrome");
else
System.out.println("Not Palindrome");
}
}
#include void main() { long int n; printf("ENTER A NUMBER: "); scanf("%ld",&n); int n1,mod; n1=n; int rev=0; while(n>0) { mod = n%10; rev = rev * 10 + mod; n = n / 10; } if (n1 == rev) printf("ENTERED NUMBER IS A PALINDROME\n"); else printf("ENTERED NUMBER NOT A PALINDROME\n"); }
Check digits are determined (or derived) by a set algorithm using the digits of the account number.
'n' can be an identifier, '1' is a digit
step 1 : input n step 2 : s = 0, a=n step 3 : while(n>0) begin rem=n%10 s=s*10+rem n=n/10 end step 4 : if(s==a) print 'it is a palindrome' else print 'it is not a palindrome' step 5 : stop
Function sum_odd_digits(ByVal number As Integer) As Integer Dim digit As Integer sum_odd_digits = 0 While number <> 0 digit = number Mod 10 If digit And 1 Then sum_odd_digits = sum_odd_digits + digit number = number / 10 End While End Function
Any number that is is a palindrome will always be a palindrome.
No.
The smallest 3-digit palindrome number is 101.
999
999
11
121
5335
The smallest 3-digit palindrome is 101.
246642
1, 2, 3
Since palindrome denotes a word that reads the same forwards as backwards, a one-digit palindrome would not make sense.