REVERSE OF A NUMBER
/* Reverse Of A Number */
#include<stdio.h>
#include<math.h>
void main()
{
int n,rev=0,sum=0,r;
printf("Enter the number");
scanf("%d",&n);
while(n!=0)
{
r=n%10;
rev=(rev*10)+r;
sum=r+sum;
n=n/10;
}
printf("Reverse is %d ",rev);
printf("Sum of digit is %d",sum);
}
No comments:
Post a Comment