ACP1_10

#include<stdio.h> int palin(int); void main() { int no,flag; clrscr(); printf("\nEnter a no. : "); scanf("%d",&no); flag=palin(no); if(flag==1) printf("\n%d is a palindrome.",no); else printf("\n%d is not a palindrome.",no); getch(); } int palin(int no) { int rem,temp=0,revno=0,check; check=no; for(;no>0;no/=10) { rem=no%10; revno=rem+temp; temp=revno*10; } if(check==revno) return 1; else return 0; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.