Basic Programs

If Else based Programs

Loop Based Programs

Array Based Programs

String Programs

Function Programs

Pointers Programs

Structure & File Handling Programs

Data Structure Programs

Loop based Programs

Program to find reverse of a number and check palindrome

   545 –reverse=545 (so this is a palindrome number)

#include <stdio.h>
#include <conio.h>
void main()
{
    int n=0, rev=0, n1=0, rem=0;
    printf("enter the no");
    scanf("%d",&n);
    n1=n;   // because after the loop, the value of n is lost to zero
     while(n>0)
       {
           rem=n%10;
           rev=rev*10+rem;
           n=n/10;
       }
    if(n1==rev//condition here if the entered no is equal to the reverse of the number.
     printf("the given number is palindrom");
    else
     printf("the given number is not palindrom");
}

Output of the above program is as following.

Video/ C Introduction

Watch video in full size
Wordpress Social Share Plugin powered by Ultimatelysocial