write program for palindrome

Answer Posted / aravindhan.d

// r=reminder,s=sum,n=number.
#include<stdio.h>
#include<conio.h>
void main()
{
int n,m,r,s=0;
clrscr();
printf("Enter the n value:");
scanf("%d",&n);
m=n;
while(n>0)
{
r=n%10;
s=s*10+r;
n=n/10;
}
if(m==s)//THIS SAME CODE IS GIVEN ABOVE BUT ONE CHANGE NOT m==n THAT IS m==s
{
printf("NUMBER IS PALINDROME");
}
else
{
printf("NUMBER IS NOT PALINDROME");
}

Is This Answer Correct ?    19 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How java is different from c and c++?

605


When you overload member functions, in what ways must they differ?

567


How can we access protected and private members of a class?

566


What are c++ storage classes?

597


What is the latest c++ version?

588






When there is a global variable and local variable with the same name, how will you access the global variable?

596


What are the benefits of pointers?

567


What is atoi?

515


Write a code/algo to find the frequency of each element in an array?

582


Does std endl flush?

586


What is istream and ostream in c++?

562


What is a linked list in c++?

520


Define pointers?

583


How do we implement inheritance in c++?

554


Write a program which uses Command Line Arguments

609