DO NOT MISS

Ads

Tuesday 2 August 2016

Program 20 Using While loop



Reverse of the given no. is equal to the given no. is known as a Palindrome no.

#include<stdio.h>
#include<conio.h>

void main()

    {

            int rev=0,r,n,t=0;
            clrscr();

            printf("enter a number:");
            scanf("%d",&n);

            t=n;
           
while(n!=0)
                 {
                      r=n%10;
                      rev=rev*10+r;
                      n=n/10;
                 }

            if(rev==t)
            printf("palindrome");
            else
            printf("not palindrome");

            getch();

   }


Output:-

______________________________________________________
______________________________________________________
______________________________________________________
_____________________________________________________




Greataims

 
Copyright © 2016 Computersadda. Designed by @ Computersadda Team - Published By Greataims