How to check whether string is a palindrome, WITHOUT USING
STRING FUNCTIONS?
Answers were Sorted based on User's Feedback
#include<stdio.h>
void main()
{
char str[10]="liril";
int i,l,count=1;
printf("first find the string length as follow\n");
printf("\n\n");
for(l=0;str[l]!='\0';l++)
{
}
printf("length of the string %s is %d\n",str,l);
printf("\n\n");
for(i=0,l=l-1;l>=0;l--,i++)
{
if(str[i]!=str[l])
{
count++;
break;
}
}
if(count==1)
printf("given string is palindrom");
else
printf("given string is not palindrom");
}
| Is This Answer Correct ? | 20 Yes | 4 No |
Answer / narasimharao
#include<stdio.h>
#include<conio.h>
void main()
{
char str[20]="malayalam",str1[20];
int i,j,k,c;
clrscr();
for(c=0;str[c]!='\0';c++)
{
}
printf("%d\n",c);
for(i=c-1,j=0;i>=0;i--,j++)
{
str1[j]=str[i];
}
printf("%s\n",str1);
k=1;
for(i=0;str[i]!='\0';i++)
{
if(str[i]!=str1[i])
{
k=0;
break;
}
}
if(k==1)
printf("Given String is Palindrome");
else
printf("Given String is Not Palindrome");
getch();
}
| Is This Answer Correct ? | 10 Yes | 8 No |
Why cd or dvd are round why not square.
what is the return type of printf
What will be the result of the following C language program? main() { int a = 0; int b = 20; char x = 1; char y = 10; if(a,b,x,y) printf("Welcome"); }
#include<stdio.h> void main() { int =1; printf("%d%d%d",a++,++a,++a); }
helllo sir give me some information of the basic information the c as printf ,scanf , %d ,%f and why is the main use of these.
find the size of structure without using the size of function
Write a program to print prime nums from 1-20 using c programing?
Write a program that takes a 5 digit number and calculates 2 power that number and prints it
What is c language & why it is used?
Which control loop is recommended if you have to execute set of statements for fixed number of times?
What is difference between the following 2 lines…. int temp = (int)(0x00); int temp = (0x00int);
Why is a semicolon (;) put at the end of every program statement?