palindrome for strings and numbers----Can anybody do the
prog?
Answer Posted / shruti
//the palindrome for string can also be written as below,
without using inbuilt functions.
void main()
{
char str[10];
int flag = 0;
int i , j;
puts("ENTER THE STRING");
fflush(stdin);
gets(str);
for(i = 0 ; str[i] != '\0' ; i++);
i--;
for(j = 0 ; j<i ; j++ , i--)
{
if(str[j] == str[i])
flag = 1;
else
{
flag = 0;
break;
}
}
if(flag == 1)
puts("STRING IS A PALINDROME");
else
puts("STRING IS NOT A PALINDROME");
}
| Is This Answer Correct ? | 4 Yes | 3 No |
Post New Answer View All Answers
What is this infamous null pointer, anyway?
a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list
What are keywords c?
Explain that why C is procedural?
Explain what is operator promotion?
What is malloc() function?
Can you explain the four storage classes in C?
What is c basic?
What is the difference between c and python?
How many main () function we can have in a project?
How can you allocate arrays or structures bigger than 64K?
Explain how do you generate random numbers in c?
Explain what is the advantage of a random access file?
what are the 10 different models of writing an addition program in C language?
What is your stream meaning?