#include<stdio.h>
#include<conio.h>
#include<string.h>
main()
{
char str[20],revstr[20];
int i,j=0,l,n;
printf("enter a string");
scanf("%s",str);
l=strlen(str);
n=l-1;
for(i=n;i>=0;i--)
{
revstr[j]=str[i];
j++;
}
revstr[j]='\0';
if((strcmp(str,revstr))==0)
printf("palindrome");
else
printf("not a palindrome");
getch();
}
use the strrev() function on the given string and compare with original string.If both are equal they are palindromes else not.
You don't have to write palindrome programs in wikipedia.
char* = "racecar"
Nothing.
#include<stdio.h> main() { int a=0,b=1,n,c,i; printf("enter number"); scanf("%d",&n); printf("%d\n",a); for(i=1;i<=n;i++) { c=a+b; printf("%d\n",c); b=a; a=c; } getch(); }
The word 'cow' is not a palindrome because it is not spelled the same backward and forward (c-o-w, w-o-c).
WAP (Wireless Application Protocol)
ans: c wap,http,arp are internet protocos, whereas baan vendor erp software
#include<stdio>
To display the number of words or sentences in a palindrome, first, you need to check if the input string reads the same forwards and backwards. Then, you can split the string into words using a space or punctuation as a delimiter. Finally, count the number of words (or sentences, if counting full sentences) and present that count alongside the palindrome verification.
/*WAP to display Fibonacci series*/ #include<stdio.h> #include<conio.h> void main() { int i,a=0,b=1,c; scanf("%d",&n); printf("%d\n%d",a,b); for(i=0;i<n;i++) { c=a+b; a=b; b=c; printf("\n%d",c); } getch(); }
what ever you assume