c program to Reverse Digits

#include <conio.h>
#include <stdio.h>
main()
{
    int x,rev=0,rem,i,sum=0;
    printf("Enter numbers to reverse:\t");
    scanf("%d",&x);
   for(i=x;x>0;x=x/10)
    {rem=x%10;
    rev=rev*10+rem;
    sum=sum+rem;
}
printf("reverse of numbers is %d and sum of digits is %d",rev,sum);
getch();
}

Comments

Popular posts from this blog