HOME

Saturday, March 14, 2015

C PROGRAM TO REVERSE THE NUMBER USING FUNCTION


#include<stdio.h>
#include<conio.h>
int reverse(int n);
main()
{
    int n;
    printf("enter the number\n");
    scanf("%d",&n);
    printf("the reverse of %d is %d",n,reverse(n));
}
int reverse(int n)
{
    int rem,rev=0;
    while(n>0)
    {
        rem=n%10;
        rev=rev*10+rem;
        n=n/10;
    }
return rev;
}

No comments:

Post a Comment