Featured
- Get link
- X
- Other Apps
C++ program to check a palindrome string
//C++ program to check a palindrome string
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
int i,j,flag=0;
char string[20];
cout<<"Enter A String\n";
cin>>string;
for(i=0;string[i]!='\0';i++);
for(j=0,--i;i>=0;--i,++j)
{
if(string[i]!=string[j])
{
flag=1;
break;
}
}
if(flag)
cout<<"Not a palindrome string";
else
cout<<"Palindrome String";
getch();
}
OUTPUT:
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
int i,j,flag=0;
char string[20];
cout<<"Enter A String\n";
cin>>string;
for(i=0;string[i]!='\0';i++);
for(j=0,--i;i>=0;--i,++j)
{
if(string[i]!=string[j])
{
flag=1;
break;
}
}
if(flag)
cout<<"Not a palindrome string";
else
cout<<"Palindrome String";
getch();
}
OUTPUT:
- Get link
- X
- Other Apps
Labels:
c program to tell if a string is palindrome or not
C++ program to check a palindrome string
string palindrome program in C
Popular Posts
C++ program to display numbers which get reversed after multiplying by 4
- Get link
- X
- Other Apps
Comments
Post a Comment