write program for palindrome
Answer Posted / niruj
/* without using string.h library */
#include<stdio.h>
#include<conio.h>
void main()
{
char *p;
char a[]="malyalam";
char rev[10];
int i;
int len=sizeof(a);
p=a;
do{
p++;
}while(*p!=NULL);
*p='\0';
i=0;
do{
p--;
rev[i]=*p;
i++;
}while(p!=a);
for(i=0;i<=len-2;i++)
{
if(a[i]==rev[i])
{
if(i==len-2)
{
printf("String is Pallindrom");
}
}
else{
printf("String is not pallindrom");
break;
}
}
getch();
}
| Is This Answer Correct ? | 5 Yes | 2 No |
Post New Answer View All Answers
What is const in c++?
When do we run a shell in the unix system? How will you tell which shell you are running?
What happens when the extern "c" char func (char*,waste) executes?
What is a lambda function c++?
Are vectors passed by reference c++?
Define a nested class.
Is c++ harder than java?
What is array in c++ pdf?
Which bitwise operator is used to check whether a particular bit is on or off?
What are libraries in c++?
What is constructor and destructor in c++?
What are guid? Why does com need guids?
What are the differences between the function prototype and the function defi-nition?
Is c the same as c++?
Is swift faster than go?