Write a program to check given number is palendrome or not.
SOLUTION:
/* * Program to check given number is palendrome or not * Written by Shaeed Khan. * Date: 04 Aug 2014 * Version- 1.0 * Language: C */ #include < stdio.h > #include < stdlib.h > void main() { int n,x; printf("Enter a number:"); scanf("%d",&n); x=palendrome(n); if(x==n) printf("Palendrome "); else printf("Not palendrome "); } int palendrome(int num) { int r=0; while(num>0) { r=r* 10 + num%10; num=num/10; } return r; }
No comments:
Post a Comment