//Aim: Write a C program that will check whether given string is palindrome or not.
Theory: A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward as forward, such as madam or racecar, NITIN Etc .
//Program:
#include <stdio.h>
#include <string.h>
int main()
{
char string1[20];
int i, length;
int flag = 0;
printf("Enter a string:");
scanf("%s", string1);
length = strlen(string1);
for(i=0;i<length;i++)
{
if(string1[i] != string1[length-i-1])
{
flag = 1;
break;
}
}
if (flag)
{
printf("%s is not a palindrome \n", string1);
}
else
{
printf("%s is a palindrome \n", string1);
}
return 0;
}
This comment has been removed by the author.
ReplyDeletenice
ReplyDeleteteaching
good,understood,nice teaching
ReplyDelete...understood....good....one.....!
ReplyDeleteunderstood
ReplyDeletewell teaching by sir understand the concept of polindrome
ReplyDeleteyou r absolutely right
DeleteFine teaching with Good Understanding
ReplyDeletenice to understand
ReplyDeleteKanchan Deshmukh nice and understood
ReplyDeleteNice palindrome concepts
ReplyDeleteeasy to understand
ReplyDeleteEasy to understand, nice one...
ReplyDeleteGood understand
ReplyDeleteunderstood
ReplyDeleteWell understood ..... Nice teaching ...
ReplyDeleteNice
ReplyDeleteGood understood
ReplyDelete