write program for palindrome
Answers were Sorted based on User's Feedback
Answer / sat
#include<stdio.h>
#include<string.h>
void main()
{
char a[40],b[40];
printf("\n Enter String:= ");
gets(a);
strcpy(b,a);
strrev(b);
if(strcmp(b,a)==0)
printf("\n Entered string \"%s\" ispalindrome",b);
else
printf("\n Entered string \"%s\" is not palindrome",a);
}
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / saurav sadangi
#include<stdio.h>
int main(){
int n,s=0,r,m;
printf("Enter m:- ");
scanf("%d",&m);
n=m;
while(m>0){
r=m%10;
s=(s*10)+r;
m/=10;
}
printf("The reverse no is %d\n",s);
if (s==n)
printf("%d is pallendrom.\n",n);
else
printf("%d is not pallendrom.\n",n);
system("PAUSE");
return 0;
}
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / lakshmi narayana
#include<stdio.h>
main()
{
int n,s=0,m;
printf("enter any no");
scanf("%d",&n);
m=n;
while(n>0)
{
int r=n%10;
s=s*10+r;
n=n/10;
}
if(s == m) // This is important step
printf("the no is palindrome\n");
else
printf("no is not palindrome\n");
return 0;
}
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / anonymous
#include<stdio.h>
#include<conio.h>
int main()
{
int n,s=0,m,r;
printf("enter any no");
scanf("%d",&n);
m=n;
while(n>0)
{
r=n%10;
s=s*10+r;
n=n/10;
}
if(m==s)
printf("the no is palindrome");
else
printf("no is not palindrome");
getch();
return 0;
}
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / dharm
#include<stdio.h>
#include<conio.h>
void main()
{
int n,s=0,m;
clrscr();
printf("enter any no");
scanf("%d",&n);
m=n;
while(n>0)
{
r=n%10;
s=s*10+r;
n=n/10;
}
if(m==s)
printf("the no is palindrome");
else
printf("no is not palindrome");
getch();
}
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / amit
#include<iostream.h>
#include<conio.h>
main()
{
char c[8];
cout<<"enterd hte world of polindorom";
cin>>c;
int i=strlen(c);
i=i-1;
int flag=0;
for(int j=0;j<=1;j++)
{
if(c[j]==c[i])
{
flag=1;
}
else
{
int flag=0;
break;
}
}
i--;
if(flag==1)
{
cout<<"your option is polindorome";
}
else
{
cout<<"your option is not polindorome";
}
getch();
}
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / darren chang
bool palind(string input)
{
int j=input.length()-1;
int i=0;
while(i<j)
{
if(input[i]!=input[j])
return false;
i++;
j--;
}
return true;
}
Is This Answer Correct ? | 23 Yes | 24 No |
Answer / deepanjan
#include<stdio.h>
void main()
{
char ch[100];
int i,j,l,flag;
l=0;
flag=0;
printf("\n Enter to check if palindrome or not \n");
gets(ch);
for(i=0;ch[i]!='\0';i++)
{
l++;
}
for(i=0,j=l-1;i<(l/2)-1,j>(l/2);i++,j--)
{
if(ch[i]==ch[j])
flag=0;
else
{
flag=1;
break;
}
}
if(flag==0)
printf("\n Entered characters are palindrome");
else
printf("\n Entered characters are not a palindrome");
}
Is This Answer Correct ? | 14 Yes | 15 No |
Answer / anirban
#include<stdio.h>
#include<string.h>
#define size 26
void main()
{
char strsrc[size];
char strtmp[size];
clrscr();
printf("\n Enter String:= "); gets(strsrc);
strcpy(strtmp,strsrc);
strrev(strtmp);
if(strcmp(strsrc,strtmp)==0)
printf("\n Entered string \"%s\" ispalindrome",strsrc);
else
printf("\n Entered string \"%s\" is not
palindrome",strsrc);
getch();
}
Is This Answer Correct ? | 12 Yes | 13 No |
Answer / kumaran
int a,n,s,x=0;
a=n;
while(n>0)
{
s=n%10;
x=x*10+s;
n=n/10;
}
if(a=n)
printf("palindrome");
else
printf("not palindrome");
Is This Answer Correct ? | 0 Yes | 1 No |
What are raw sockets, where they are efficient?
Write a corrected statement in c++ so that the statement will work properly. if (x > 5); y = 2*x; else y += 3+x;
CAN U SAY WHICH PROGRAMING LANGUAGE IS USED BY DOCTORS....?
Describe the advantages of operator overloading?
The "virtual" specifier in a member function enables which one of the following? a) Monmorphism b) Late binding c) Metamorphism d) Solomorphism e) Inheritance
Can you be bale to identify between straight- through and cross- over cable wiring? And in what case do you use straight- through and cross-over?
Explain about vectors in c ++?
write a program in c++ to generate imp z y x w v w x y z z y x w x y z z y x y z z y z z
Memory is not a constraint. In a single iteration(NOTE: you can't go back), how will you find out the 10th last node/item in a linked list.
16 Answers BNB, FDS, Goldman Sachs, Nagarro,
What does '\r' and '\b' mean? Please explain with example.
How can a called function determine the number of arguments that have been passed to it?
Can constructor be private in c++?