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>
You don't have to write palindrome programs in wikipedia.
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;
To write a C program to determine if something is odd or even you need to be a programmer. To write a program in C is complicate and only done by programmers.
sdfdg
#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; }
You can do this: <?php if ( $word === strrev( $word ) ) { echo "The word is a palindrome"; } else { echo "The word is not a palindrome"; }
You don't have to write palindrome programs in wikipedia.
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;
write a c++program by using if statement to read a number and check whether it is positive or negative
int pallindrom(int p){ /*write all logic*/ }
It is a simple program. i think u may understand it :#include#include#includevoid main(){char s[10]=answers.com;char x[10];int a;clrscr();strcpy(x,s);strrev(s);a=strcmp(s,x);if(a==0){printf("the entered string is palindrome");}else{printf("the entered string is not palindrome");}output:given string is not palindrome
You write the number and then follow it with the digits in reverse order.
because no number starts with 0. A palindrome has to start and end with the same number. For example you would have to write 020 (twenty) for it to be considered a palindrome, and that would not be the correct way to write numbers.
To write a C program to determine if something is odd or even you need to be a programmer. To write a program in C is complicate and only done by programmers.
unsigned reverse (unsigned n) { unsigned r = 0; while (n) { r *= 10; r += (n%10); n /= 10; } return r; } bool is_palindrome (unsigned n) { return n == reverse (n); } int main () { unsigned num; printf ("Enter a number: "); scanf ("%d", num); if (is_palindrome (num)) printf ("%d is a palindrome\n"); else printf ("%d is not a palindrome\n"); return 0; }
sdfdg
write a program in C to check whether a given number is apalindrome or not