Tuesday , November 21 2017
Home / c-program / C Program – Reverse of a number

C Program – Reverse of a number

C program to reverse of a number.

Reverse of a number :


#include<stdio.h> 
int reverse(int n); 
int main(void) 
{ 
    int num; 
    printf("Enter any number to reverse : "); 
    scanf("%d",&num); 
    printf("Reverse of given number : %d\n",reverse(num));     
    return 0; 
} 
int reverse(int n) 
{ 
    int rev=0; 
    do 
    { 
        rev=rev*10+n%10; 
        n/=10; 
    }while(n>0); 
    return rev; 
}

Enter any number to reverse : 45623
Reverse of given number : 32654

Happy Learning 🙂

About chandrashekhar

Hi Folks, you have reach this so far, that shows you like what you are learning. Then why don't you support us to improve for bettor tutorials by leaving your valuable comments and why not you keep in touch with us for latest updates on your favorite blog @ facebook , twitter , Or Google+ ,

Recommended

C Program to add elements of an array

How to add elements in an array using C Program. Add elements of an Array …

Leave a Reply

Your email address will not be published. Required fields are marked *