This Program will check if the given word or sentence is palindrome or not
Additional Information is listed in the program
Click on the download button below to get the zip file
DOWNLOAD
Coding
#include<conio.h>
#include<stdio.h>
#include<string.h>
main()
{
int a,t,i,flag;
char ch[50];
do
{
clrscr();
printf("Enter your sentence : ");
gets(ch);
a=strlen(ch);
t=a/2;
a--;
for(i=0; i<t; i++)
{
if(ch[i]==ch[a])
{
flag=1;
a--;
}
else
{
flag=0;
a--;
i=t;
}
}
if(flag==1)
printf("Yes, It is paliromee");
else
printf("No, it is not palindrome");
printf("\n\nDo you want to run this program again (y/n) ?");
}
while(getche()!='n');
}
Additional Information is listed in the program
Click on the download button below to get the zip file
DOWNLOAD
Coding
#include<conio.h>
#include<stdio.h>
#include<string.h>
main()
{
int a,t,i,flag;
char ch[50];
do
{
clrscr();
printf("Enter your sentence : ");
gets(ch);
a=strlen(ch);
t=a/2;
a--;
for(i=0; i<t; i++)
{
if(ch[i]==ch[a])
{
flag=1;
a--;
}
else
{
flag=0;
a--;
i=t;
}
}
if(flag==1)
printf("Yes, It is paliromee");
else
printf("No, it is not palindrome");
printf("\n\nDo you want to run this program again (y/n) ?");
}
while(getche()!='n');
}
No comments:
Post a Comment