A five digit number is entered through the keyboard . write a program to obtain the reversed number and to determine whether the original and reversed numbers are equal or not.

 /*Program for  three  Digit number check wheater the original and reverse

are equal or not.*/

#include<stdio.h>
int main()
{
    int num,n1,n2,n3,rev;
    printf("Enter the three digit number :");
    scanf("%d",&num);
    n3=num%10;
    num=num/10;
    n2=num%10;
    num=num/10;
    n1=num%10;
    num=num/10;
    rev=n3*100+n2*10+n1*1;
    printf("Please once again enter the
same number:");
    scanf("%d",&num);
    printf("\n%d",rev);
    if (rev==num)
    {
        printf("\nThe Original number and
reversed number are equal.\n");
    }
    else
    {
        printf("\nThe Original number and
reversed number are not equal!\n");
    }
    return 0;
}
/*output*/
Enter the three digit number :123 Please once again enter the same number:123 321 The Original number and reversed number are not equal!

Comments

Popular posts from this blog

5 d.) program to print this :