Check palindrome without using library functions
write a C program to check the string whether it is palindrome or not
CONSTRAINT : without using library functions
Sample input 1: madam
Sample output 1: Palindrome
Sample input 2 : jobat
Sample output 2 : Not a Palindrome
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #include <stdio.h> #include <string.h> int main() { char str[30]; int len,start,end,flag=0; gets(str); //length of string for(int i=0;str[i];len++,i++); //check palindrome with two pointers for start and end for( start=0,end=len-1;start<end;start++,end--) { if(str[start]!=str[end]) { flag=1; break; } } if(flag==0) printf("Palindrome"); else printf("Not a Palindrome"); return 0; } |
OUTPUT :
2 comments
Really impressed to visit your wonderful blog and I have a lot of info from your post. Keep it up...
ReplyDeletePlacement Training in Chennai
Best placement Training institutes in Chennai
Power BI Training in Chennai
Job Openings in Chennai
Pega Training in Chennai
Soft Skills Training in Chennai
JMeter Training in Chennai
Tableau Training in Chennai
Appium Training in Chennai
Placement Training in Anna Nagar
It is an very unique and informative information. Keep sharing on more.
ReplyDeleteAngularJS training in chennai | AngularJS training in anna nagar | AngularJS training in omr | AngularJS training in porur | AngularJS training in tambaram | AngularJS training in velachery