class test
{
public static void main(int num)
{ int num2=num;
int rnum=0;
while (num2>0)
{ int q=num2/10;
int dig=num2%10;
rnum = rnum*10+dig;
num2=q;
}
if (rnum==num)
System.out.println("Palindrome number");
else
System.out.println("Not a Palindrome number");
}
}
Palindrome number is a number like 121 which remains the same when its digits are reversed. To find this number in a simple java program, just follow the below way. sum = 0; while(n>0) { r=n % 10; sum=concat(r); n=n / 10; } print r;
This program only suits PHP. If you want a proper one try C program for it available on web <body> <?php if(isset($_POST['submit'])) { $text = $_POST['text']; $string = mysql_real_escape_string($text); $invert = strrev($string); if($string == $invert) { echo "<br>Given number is a palindrome!!"; } else { echo "<br>Given number is not a palindrome!!"; } } ?> <form method="post"> <input type="text" name="text" id="text" /> <input type="submit" name="submit" value="Submit" id="submit" onclick="<?php $_SERVER['PHP_SELF']; ?>" /> </form> </body>
The generation of palindromic numbers within a given range is best done with a computer program. Space it limited so an example of program code cannot be shown here, but the Codecast website gives full guidance.
#include <stdio.h> #include <string.h> #define N 100 #define PALINDROME 0 #define NONPALINDROME 1 /*Program that tells you whether what you enter is a palindrome or not*/ char pal[N]; //input line int i; //counter int k; //counter int tag; int flag = PALINDROME; /*flag=0 ->palindrome, flag =1 ->nonpalindrome*/ int main() { printf("Enter something: \n"); scanf("%s", pal); tag = strlen(pal); /*determine length of string*/ /* pointer running from the beginning and the end simultaneously looking for two characters that don't match */ /* initially assumed that string IS a palindrome */ /* the following for loop looks for inequality and flags the string as a non palindrome the moment two characters don't match */ for (i=0,k=tag-1; i=0; i++,k--) { if(pal[i] != pal[k]) { flag=NONPALINDROME; break; } } if(flag == PALINDROME) { printf("This is a palindrome\n"); } else { printf("This is NOT a palindrome\n"); } return 0; } #include <stdio.h> #include <string.h> #define N 100 #define PALINDROME 0 #define NONPALINDROME 1 /*Program that tells you whether what you enter is a palindrome or not*/ char pal[N]; //input line int i; //counter int k; //counter int tag; int flag = PALINDROME; /*flag=0 ->palindrome, flag =1 ->nonpalindrome*/ int main() { printf("Enter something: \n"); scanf("%s", pal); tag = strlen(pal); /*determine length of string*/ /* pointer running from the beginning and the end simultaneously looking for two characters that don't match */ /* initially assumed that string IS a palindrome */ /* the following for loop looks for inequality and flags the string as a non palindrome the moment two characters don't match */ for (i=0,k=tag-1; i=0; i++,k--) { if(pal[i] != pal[k]) { flag=NONPALINDROME; break; } } if(flag == PALINDROME) { printf("This is a palindrome\n"); } else { printf("This is NOT a palindrome\n"); } return 0; }
#include <stdio.h> #include<conio.h> void main () { int a,r,n,sum=0; clrscr(); printf("enter the number"); scanf("%d",& n); c=n while (n!=0) { a=n%10; n=n/10; sum=sum*a+a } printf("the reverse is %d \n",sum); if(c==sum) printf("\n the given number is palindrome"); else printf("\n the given number is not a palindrome"); getch(); }
A palindrome number: If the reverse of the number is equal to the number itself, then it is said to be a palindrome number. For example: 11, 22 ,55, etc...
The number '4' can be considered a palindrome because it is read the same whether forward or backward. It can become another palindrome when it is considered as 2x2.
There is no number palindrome for 563. A number palindrome is a number which is the same number when the digits are taken in the reverse order. For example, 2002 is the number palindrome of 2002 as it reads the same no matter which way it is read. Whereas 563 when read in reverse is "365" which is not the same as "563". Therefore ,there is no number palindrome for 563.
Palindrome number is a number like 121 which remains the same when its digits are reversed. To find this number in a simple java program, just follow the below way. sum = 0; while(n>0) { r=n % 10; sum=concat(r); n=n / 10; } print r;
No, 74 is not a palindrome. A palindrome is a word, line, verse, number, sentence, etc., that reads the same backward as forward, for example Madam,
A "one step palindrome is "any number can be changed into a palindrome number by reversing the digits and adding to the original number" one time. For example, the number 23 can be turned into a palindrome in just one step: 23 + 32 = 55 The same goes for the number 12: 12 + 21 = 33
Is a number that reads the same whether you read the digits from left to right or from right to left.
A palindrome is any number that, if you "read it backwards", is equal to the original number, for example, 12421.
Any number that is is a palindrome will always be a palindrome.
Since a palindrome is just a number that reads the same way back and forth, the smallest palindrome would be 1. As there are an infinite number of palindromes (as you could just take any palindrome and simply place the same number in front of it and behind it, for example: 3, 939,99399,9993999,999939999, etc.), there is no biggest palindrome (infinity)
This program only suits PHP. If you want a proper one try C program for it available on web <body> <?php if(isset($_POST['submit'])) { $text = $_POST['text']; $string = mysql_real_escape_string($text); $invert = strrev($string); if($string == $invert) { echo "<br>Given number is a palindrome!!"; } else { echo "<br>Given number is not a palindrome!!"; } } ?> <form method="post"> <input type="text" name="text" id="text" /> <input type="submit" name="submit" value="Submit" id="submit" onclick="<?php $_SERVER['PHP_SELF']; ?>" /> </form> </body>
A number that reads the same backwards as it does forwards. For example 1357531, or 121.