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

WAP to find that given no is small or capital

3 Answers  


44.what is the difference between strcpy() and memcpy() function? 45.what is output of the following statetment? 46.Printf(“%x”, -1<<4); ? 47.will the program compile? int i; scanf(“%d”,i); printf(“%d”,i); 48.write a string copy function routine? 49.swap two integer variables without using a third temporary variable? 50.how do you redirect stdout value from a program to a file? 51.write a program that finds the factorial of a number using recursion?

6 Answers   Amdocs,


Define recursion in c.

0 Answers  


difference between loading and linking

1 Answers  


Which programming language is best for getting job 2020?

0 Answers  






What would happen to X in this expression: X += 15; (assuming the value of X is 5)

0 Answers  


Wt are the Buses in C Language

0 Answers   Infosys,


the maximum value that an integer constant can have is a) -32767 b) 32767 c) 1.701e+38 d) -1.7014e+38

1 Answers  


Can a program have two main functions?

0 Answers  


when user give a number it multiply with 9 without useing '+' and '*' oprator

4 Answers  


Explain the properties of union. What is the size of a union variable

0 Answers  


write a fuction for accepting and replacing lowercase letter to'Z' with out using inline function.

5 Answers   Temenos,


Categories