adsense

Hii, welcome to my site. My name is Om prakash kartik. This blog helps you to learn programming languages concepts.

C program for palindrome

C program for palindrome using while loop

#include<stdio.h>
#include<conio.h>
  void main()
    {
    long int rev=0,n,p;
    clrscr();
    printf("Enter a no.:-");
    scanf("%ld",&n);
    p=n;
    while(n!=0)
      {
      rev=n%10+rev*10;
      n=n/10;
      }
   if(p==rev)
        printf("%ld is palindrome",p);
   else
        printf("%ld is not palindrome",p);
   getch();
   }

Output:-





Post a Comment

0 Comments