#include<stdio.h>
#include<conio.h>
#include<math.h>
main(){
long int num,i,a,b;
printf("Enter an integer:\n");
scanf("%ld",&num);
b=num;
for(i=1; ;++i){
a=b%10;
printf("%ld",a);
b=b/10;
if(b==0)
break;
}
getch();
}
Reversing the digits of a number means reversing the sequence of digits in a number.
ReplyDeleteBefor reverse : 25346
After reverse : 64352
We can also reverse digits of a number using recursion