C Program To Reverse A Number Enter By User

C Program To Reverse A Number Enter By User

Code
// WAP To Reverse A Number...

# include <stdio.h>
int main(){
    int num, digit, rev=0;
    printf("Enter Number:\n");
    scanf("%d",&num);
    while (num!=0)
    {
        digit = num%10;
        num = num/10;
        rev = (rev * 10) + digit; 
    }
    printf("Reverse Of Number Is:%d",rev);
    return 0;
}
Output
Enter Number:
436
Reverse Of Number Is:634 

Post a Comment