Program in C to check a number is Palindrome or not using Function
#include<stdio.h> #include<conio.h> int CheckPalin(int n) { int rev=0; while(n!=0) { rev=n%10+10*rev; n=n/10; } return (rev); } int main() { int n1,r; printf("Enter a number:-"); scanf("%d",&n1); r=CheckPalin(n1); if(n1==r) printf("%d is Palindrome No.",n1); else printf("%d is not Palindrome No.",n1); //getch(); return 0; }Output:-
0 Comments