answersLogoWhite

0


Best Answer

/*To check whether a string is palindrome*/

  1. include
  2. include

void 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 (); }

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Program to check that given string is palindrome or not in C?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Bluej program-read a string and check if the given string is a palindrome?

import java.util.Scanner; public class Palindrome{ public static void main(String[] args){ String front; String back =""; char[] failure; String backwards; Scanner input=new Scanner(System.in); System.out.print("Enter a word: "); front=input.next(); front=front.replaceAll(" ", ""); failure=front.toCharArray(); for (int i=0; i<failure.length; i++){ back=failure[i] + back; } if (front.equals(back)){ System.out.print("That word is a palindrome"); }else System.out.print("That word is not a palindrome"); }}


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>


How do you check given string is palindrome or not with out using string functions?

/*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 ();}


Wap in c plus plus to find out the string is palindrome or not in?

use the strrev() function on the given string and compare with original string.If both are equal they are palindromes else not.


How do you check whether a string is palindrome or not using vb Script?

Private Sub Command1_Click() a = Text1.Text b = StrReverse(a) If a = b Then Print "palindrome" Else Print "not palindrome" End If End Sub

Related questions

How do you determine if a given string is palindrome or not?

Reverse the string and compare it to the original. If they match, then it is a palindrome.


Bluej program-read a string and check if the given string is a palindrome?

import java.util.Scanner; public class Palindrome{ public static void main(String[] args){ String front; String back =""; char[] failure; String backwards; Scanner input=new Scanner(System.in); System.out.print("Enter a word: "); front=input.next(); front=front.replaceAll(" ", ""); failure=front.toCharArray(); for (int i=0; i<failure.length; i++){ back=failure[i] + back; } if (front.equals(back)){ System.out.print("That word is a palindrome"); }else System.out.print("That word is not a palindrome"); }}


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>


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

int Palindrome(char *userStringStart) { char *userStringEnd = userStringStart; do { *userStringEnd |= 32; } while(*++userStringEnd); do{ while(*userStringStart < 97 *userStringStart > 122) userStringStart++; while(*userStringEnd < 97 *userStringEnd > 122) userStringEnd--; if(*userStringStart != *userStringEnd) return 0; } while(userStringStart++ <= userStringEnd--); return 1; }


How do you check given string is palindrome or not with out using string functions?

/*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 ();}


WAP to find Palindrome in given sentence like - The new radar is placed on station - asked in persistent written test?

plz any1 give code on given exampleAs i know we can check String is it palindrome or not..take a look onCode_for_palindrome_checking_in_c_programmingorvoid main(){char strsrc[100];char strtmp[100];printf(" Enter String:= ");gets(strsrc);strcpy(strtmp,strsrc);strrev(strtmp);if(strcmp(strsrc,strtmp)==0)printf("\n Entered string " %s " is palindrome",strsrc);elseprintf("\n Entered string "%s" is not palindrome",strsrc);getch();}You cite 2 examples of what you are looking for so why are you asking the question? The palindrome is word "radar" so obviously the program needs to extract individual word from the string in order to test. That is a simple thing to do. I am not going to do it for you because if I do you do not learn what you need to know.....i did separated string by for (i=0 arr!=arr.lnegth i++){if(arr[i]==" ")} then each string checked for this code but that not right as persistence employee said..


Could you write a assembly language program in tasm To check whether a given number present in a sequence of given memory location containing the string to be checked in 8086?

8086 assembly language program to check wether given number is perfect or not


Design an algorithm to check whether a given string is a palindrome or not?

#include <stdio.h> #include <conio.h> #include <string.h> void input(char a[ ]) { int i; printf("\n enter string\n"); scanf("%s",a); } void output(char a[ ]) { printf("\n string is %s",a); } int palindrome(char a[ ]) { int n,i; n=count(a); n=n-1; i=0; for(;a[n]==a[i] && n>=i;i++,n--); if(n>=i) return 0; else return 1; } void main( ) { char a[80],b[80],s; int n; printf("\n check palindrome"); input(a); n=palindrome(a); output(a); if(n==1) printf("\n palindrome"); else printf("\n not palindrome"); getch(); }


Write an algorithm to check whether a given string is palindrome or not?

#include <stdio.h> #include <conio.h> #include <string.h> void input(char a[ ]) { int i; printf("\n enter string\n"); scanf("%s",a); } void output(char a[ ]) { printf("\n string is %s",a); } int palindrome(char a[ ]) { int n,i; n=count(a); n=n-1; i=0; for(;a[n]==a[i] && n>=i;i++,n--); if(n>=i) return 0; else return 1; } void main( ) { char a[80],b[80],s; int n; printf("\n check palindrome"); input(a); n=palindrome(a); output(a); if(n==1) printf("\n palindrome"); else printf("\n not palindrome"); getch(); }


Design a algorithm to check whether a given string is palindrome or not?

#include <stdio.h> #include <conio.h> #include <string.h> void input(char a[ ]) { int i; printf("\n enter string\n"); scanf("%s",a); } void output(char a[ ]) { printf("\n string is %s",a); } int palindrome(char a[ ]) { int n,i; n=count(a); n=n-1; i=0; for(;a[n]==a[i] && n>=i;i++,n--); if(n>=i) return 0; else return 1; } void main( ) { char a[80],b[80],s; int n; printf("\n check palindrome"); input(a); n=palindrome(a); output(a); if(n==1) printf("\n palindrome"); else printf("\n not palindrome"); getch(); }


Write a Java Program to find occurences of given word in a text?

Check the documentation of the String class, for a method that searches for a substring.


Wap in c plus plus to find out the string is palindrome or not in?

use the strrev() function on the given string and compare with original string.If both are equal they are palindromes else not.