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

Is c better than c++?

643


How do you differentiate between overloading the prefix and postfix increments?

603


Explain selection sorting. Also write an example.

596


What will the line of code below print out and why?

338


What is private public protected in c++?

561






What is std namespace in c++?

737


List the advantages of inheritance.

652


Explain virtual class and friend class.

618


What do you mean by ‘void’ return type?

620


What is oops in c++?

605


What do you mean by stack unwinding in c++?

744


Can char be a number c++?

610


How does work in c++?

608


What is the role of static keyword for a class member variable?

645


What are multiple inheritances (virtual inheritance)? What are its advantages and disadvantages?

583