answersLogoWhite

0


Best Answer

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;

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: 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?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Program to check that given string is palindrome or not in C?

/*To check whether a string is palindrome*/includeincludevoid main () { int i,j,f=0; char a[10]; clrscr (); gets(a); for (i=0;a[i]!='\0';i++) { } i--; for (j=0;a[j]!='\0';j++,i--) { if (a[i]!=a[j]) f=1; } if (f==0) printf("string is palindrome"); else printf("string is not palindrome"); getch (); }


What is an example program in Bluej whether a number is a palindrome or not?

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


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

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


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

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>


Write a c program whether a given word is palindrome do using function?

int main(int argc, char* argv[]){char a[10],b[10];printf("enter any string\n");scanf("%s",a);printf("a=%s",a);strcpy(b,a);strrev(b);printf("\nb=%s",b);if(strcmp(a,b)==0)printf("\nstring is palindrome");elseprintf("\nnot pelindrome");return 0;}

Related questions

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

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


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


Program to check that given string is palindrome or not in C?

/*To check whether a string is palindrome*/includeincludevoid main () { int i,j,f=0; char a[10]; clrscr (); gets(a); for (i=0;a[i]!='\0';i++) { } i--; for (j=0;a[j]!='\0';j++,i--) { if (a[i]!=a[j]) f=1; } if (f==0) printf("string is palindrome"); else printf("string is not palindrome"); getch (); }


Which of these is a palindrome 56546 or 56456 or 45654?

45654 is the palindrome because it reads the same whether forward or backward.


Is 4 a palindrome?

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.


Why isn't palindrome spelled the same way backwards and forwards?

Because palindrome is not a palindrome. However, a dromedary is the same thing whether it is going backwards or forwards.


What requires a binding site called palindrome?

A palindrome indicates a statement that has the same meaning, whether read backward or forward.


Is spot a palindrome for tops?

No, because a palindrome is when a word is spelled exactly the same whether you read it left to right or right to left. The word 'tops' is not a palindrome because it is not spelled the same way if you read it from the last letter the first. An example of a palindrome is radar.


A sentence with the word palindrome?

A palindrome is any series of letters, numbers or other symbols that are the same whether read forward or backward, such as the word level.


What is an example program in Bluej whether a number is a palindrome or not?

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


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

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


What is a good sentence in using the word palindrome?

A palindrome is a word or a phrase that is the same whether you read it backwards or forwards.The word `refer' is a palindrome.Lester spent his nights memorizing palindromes.