HACKERS UNDERGROUND © 2012 BY RISHABH SHARMA

Friday, 13 January 2012

program will give the reverse of given natural number and it also check the palindrome of given number

/* This is a 'C' program.
 This program will give the reverse of given natural number as output
 and it also check the palindrome of given number.*/
 #include<stdio.h>
 #include<conio.h> //header files
 void main()
 {
 int a,n,t,sum;//variables
 clrscr();
 printf("\n Enter a number [natural number]:");
 scanf("%d",&n);
 t=n;
 sum=0;
 while(n>0)
 {
 a=n%10;
 sum=sum*10+a;
 n=n/10;
 }
 printf("\n The Reverse of given number is:%d",sum);
 if(t==sum)
 printf("\n And the given number is Palindrome!!!");
 else
 printf("\n And the given number is Not Palindrome!!!");
 getch();
 }

0 comments:

Post a Comment

 
Design by HACKERS UNDERGROUND
HACKERS UNDERGROUND © 2012 BY RISHABH SHARMA