write program for palindrome
Answers were Sorted based on User's Feedback
Answer / apoorv
#include<stdio.h>
#include<conio.h>
int main()
{
long int n,s=0,m,r;
printf("enter any no");
scanf("%ld",&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 | 1 No |
Answer / jamai partha
#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(s==n)
printf("the no is palindrome");
else
printf("no is not palindrome");
getch();
}
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / ashok
#include <stdio.h>
#include <stdlib.h>
int main ()
{
int i,j,f=0;
char a[10];
clrscr (); // only works on windows
gets(a);
for (i=0;a[i]!='\0';i++)
{
}
i--;
for (j=0;a[j]!='\0';j++,i--)
{
if (a[i]!=a[j])
{
printf("string is not palindrome");
return(0);
}
}
printf("string is palindrome");
return(0);
}
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / bhavesh vala
#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==n)
printf("the no is palindrome");
else
printf("no is not palindrome");
getch();
}
Is This Answer Correct ? | 1 Yes | 2 No |
Answer / m.sathish krishna
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,s=0,m;
clrscr();
printf("enter n");
scanf("%d",n);
m=n;
while(n>0)
(
r=n%10;
s=s*(10+r);
n=n/10;
}
if(m=n)
{
printf("it is palindrom");
}
else
{
printf("not a polindrom");
}
getch();
}
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / bala murali
#include<stdio.h>
#include<conio.h>
main()
{
char s1,s2;
printf("enter a string:");
gets(s1);
strcpy(s2,s1);
strrev(s2);
if(strcmp(s1,s2))
printf("palindrome:");
else
printf("not a palindrome:");
getch();
}
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / prakash
#include<stdio.h>
#include<conio.h>
main()
{
char s1[10],s2[10];
int m,i,j;
scanf("%s",s1);
strcpy(s2,s1);
m=strlen(s1);
for(i=0,j=m-1;i<=m-1,j<=0;i++,j--)
{
if(s1[i]!=s2[j])
printf("STRING IS NOT PALINDROME ");
}
printf("STRING IS a PALINDROME ");
getch();
}
Is This Answer Correct ? | 0 Yes | 2 No |
Answer / krishna reddy
#include<stdio.h>
#include<conio.h>
void main()
{
int n,m,s,reverse=0;
clrscr();
printf("enter any no");
scanf("%d",&n);
m=n;
while(n!=0)
{
s=n%10;
reverse=reverse*10+s;
n=n/10;
}
if(m==reverse)
printf("the no is palindrome");
else
printf("no is not palindrome");
getch();
}
Is This Answer Correct ? | 0 Yes | 2 No |
Answer / gunajit bhuyan (ulubar, guwaha
void main()
{
int n,num,digit,sum,rev;
printf("input a number to check for palindrom\n");
scanf("%d",&n);
n=num;
do
{
digit=num%10;
sum+=digit;
rev=rev*10+digit;
num/=10;
while (num!=0);
printf("sum of the digits of the number is =%d",sum);
printf("Reverse of the number is =%d",rev);
if(n==rev)
printf("this number is palindrom");
else
printf("this number is not palindrome");
getch();
}
Is This Answer Correct ? | 0 Yes | 2 No |
Answer / md. irshad alam
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
void main()
{
clrscr();
int palind(char []);
int r;
char name[5];
cout<<"Enter a String...";
gets(name);
r=pal(name);
if(r==0)
{
cout<<"\n"<<"PALINDROME...";
}
else
{
cout<<"\n"<<"NOT A PALINDROME...";
}
getch();
}
int palind(char name[])
{
char *p,*t;
p=name;
t=name+strlen(name)-1;
while(*p)
{
if(*p != *t)
{
return(1);
}
p++;
t--;
}
return(0);
}
Is This Answer Correct ? | 0 Yes | 2 No |
Please explain class & object in c++?
Do the names of parameters have to agree in the prototype, definition, and call to the function?
What is the difference between Class and Structure?
40 Answers HP, IBM, Samsung, TCS,
How long does it take to get good at leetcode?
Which is the best c++ compiler for beginners?
What do you mean by C++ access specifiers ?
write asingle linked list which read from two list & the do the following 1 sort the prime & nonprime num (prime should be less tn nonprime) 2 each node has a prime num followd by nonprime 3 add a new node into its sutable plce 4 erase the most three duplicated non prime num 5 find the least duplicated prime num
What are proxy objects in c++?
Is main a class in c++?
What is the difference between a declaration and a definition?
What is atoi in c++?
What is the difference between a template and a macro?