how to write palindrome program?

Answers were Sorted based on User's Feedback



how to write palindrome program?..

Answer / a.prathyusha

#include<stdio.h>
void main()
{
int n,s=0,r,n1;
printf("enter any number:");
scanf("%d",&n);
n1=n;
while(n>0)
{
r=n%10;
s=(s*10)+r;
n=n/10;
}
if(s==n1)
printf("palindrom");
else
printf("not palindrom");
}

Is This Answer Correct ?    7 Yes 1 No

how to write palindrome program?..

Answer / arnab

#include<iostream.h>
#include<conio.h>
void main()
{ int num, num1, rem, rev=0;
cin>>num;
num1=num;
while(num!=0)
{
rem=num%10;
rev=rev*10+rem;
num=num/10;
}
if(num1==rev)
cout<<"yes the no. is pallindrome";
else
cout<<"no the no. is not pallindrome";
getch();
}

Is This Answer Correct ?    0 Yes 0 No

how to write palindrome program?..

Answer / shweta

when we do reverse any no then we find a new no and this
no is equal to our privous no,which is called palindrom no.
by program
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int n,m,sum=0,l;
printf("enter any no");
scanf("%d",&n);
while(n>0)
{
m=n%10;
sum=sum*10+m;
n=n\10;
}
if(n==l)
{
printf("no is palindrom");
}
else
{
printf("no is not palindrom");
}
getch();
}

Is This Answer Correct ?    2 Yes 5 No

Post New Answer

More C Interview Questions

code snippet for creating a pyramids triangle ex 1 2 2 3 3 3

4 Answers  


What is const volatile variable in c?

0 Answers  


Hai friends im a i year student. i want to develop my knowledge in the field of TSR in c. How I'm Improve ?

2 Answers  


How to access or modify the const variable in c ?

16 Answers   HCL, HP,


What’s a signal? Explain what do I use signals for?

0 Answers  






Differentiate between full, complete & perfect binary trees.

0 Answers  


Who had beaten up hooligan "CHAKULI" in his early college days?

1 Answers  


What is malloc and calloc?

0 Answers  


Write a programe print the sum of series 0,1,2,.....10

7 Answers  


write a program which counts a product of array elements lower than 10.

1 Answers  


What is the difference between ‘g’ and “g” in C?

1 Answers  


What is 'bus error'?

0 Answers  


Categories