Friday, 23 November 2012

Example:C Palindrome Program


By on 00:11

Firstly I explain you what we done in this program or what is palindrome program in c language.Let us take an example 

121=121(The reverse of no. 121 is 121 ,that's the palindrome program) other example like 131=131,141=141.


Q)Write a program to enter digit and check the number is palindrome or not.



Note:-You can also create this program in c++(c plus plus),java,c#(c sharp) languages with the same logic.


P:#include<stdio.h>
void main()
{
int r,n,d,a;

printf("enter digit/no.");
scanf("%d",&n);
r=0;a=n;
while(n!=0)  //while(n)
{
d=n%10;
r=r*10+d;
n=n/10;
}
if(r==a)
{
printf("Your's number is palindrome")
}
else
{
printf("Not palindrome")
}
getch();
}}



If you have any query then leave your comments and don't forgot to follow me on Google+,Facebook,Twitter.


0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...