answersLogoWhite

0


Best Answer

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>

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a PHP program to check whether the number is palindrome or not?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How do you write a palindrome program in c in Wikipedia?

You don't have to write palindrome programs in wikipedia.


Write a program using method plainto check whether a string is a palindrome or not A palindrome is a string that reads the same from left to right and vice-versa?

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&gt;0) { r=n % 10; sum=concat(r); n=n / 10; } print r;


How do you write a C program to check whether the number is odd or even Ps-using DEV complier?

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.


Write c program to print palindrome using string without using strrev strlen strcam?

sdfdg


Write a c program that reverse a given integer number and check whether the number is palindrome or not?

#include &lt;stdio.h&gt; #include &lt;string.h&gt; #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 -&gt;palindrome, flag =1 -&gt;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 &lt;stdio.h&gt; #include &lt;string.h&gt; #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 -&gt;palindrome, flag =1 -&gt;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; }

Related questions

Write a PHP program to check whether the string is palindrome or not?

You can do this: &lt;?php if ( $word === strrev( $word ) ) { echo "The word is a palindrome"; } else { echo "The word is not a palindrome"; }


How do you write a palindrome program in c in Wikipedia?

You don't have to write palindrome programs in wikipedia.


Write a program using method plainto check whether a string is a palindrome or not A palindrome is a string that reads the same from left to right and vice-versa?

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&gt;0) { r=n % 10; sum=concat(r); n=n / 10; } print r;


Write a program By using if else statement to read a number and check whether it is positive or negative?

write a c++program by using if statement to read a number and check whether it is positive or negative


How do you write palindrome program in c language?

int pallindrom(int p){ /*write all logic*/ }


How do you write a program in C to check whether a word is a palindrome or not?

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


How can you generate a palindrome from a given number?

You write the number and then follow it with the digits in reverse order.


Why are there no palindromes that are multiples of 10?

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.


How do you write a C program to check whether the number is odd or even Ps-using DEV complier?

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.


How do you write a simple program in c to check whether a number is a palindrome or not?

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; }


Write c program to print palindrome using string without using strrev strlen strcam?

sdfdg


Lab manual in mca 1st sem from ignou?

write a program in C to check whether a given number is apalindrome or not