program to check string is plaindrome in c-programming
In this program ,we will check which string is plaindrome or not by taking input string form the user .
#include<stdio.h>
#include<conio.h>
void main()
{
char str[20];
int i,l;
printf("enter the string:-");
gets(str);
l=strlen(str);
for(i=0;i<l/2;i++){
if(str[i]!=str[l-i-1]){
printf("not a plaindrome");
break;
}
}
if(i==l/2)
printf("string is plaindrome");
getch();
}
#include<conio.h>
void main()
{
char str[20];
int i,l;
printf("enter the string:-");
gets(str);
l=strlen(str);
for(i=0;i<l/2;i++){
if(str[i]!=str[l-i-1]){
printf("not a plaindrome");
break;
}
}
if(i==l/2)
printf("string is plaindrome");
getch();
}
output:-
For more c-programming:-

No comments:
Post a Comment