Header Ads

WAP to Print the Given Number is Reverse Order in C - 46

This program print's the given Number in the Revered Order in C

Program Code:

/*   program to find reverse of the given number in C */

#include <stdio.h>
int main() 
{
        int data, mod, res = 0;
        printf("Enter Number to be Reversed : ");
        scanf("%d", &data);

        /* find reverse of the given number */
        while (data > 0) {
                mod  = data % 10;
                res  = (res * 10) + mod;
                data = data / 10;
        }

        printf("Reverse Number is : %d", res);
        return 0;
  }

Program Output:

No comments