Previous | Home | Next |
/** Program to Reverse the digits of a given number **/ #include<stdio.h> #include<conio.h> void main() { long int num, a, b; long int ctr=0,s=0; clrscr(); printf ("Enter the digit "); scanf ("%ld",&num); while (num!=0) { a=num%10; num=num/10; s=s*10; s=s + a; ctr++; } printf ("The reverse No. is=%ld" ,s); printf("\n count=%ld", ctr); getch(); }
Enter the digit
62415
The reverse No. is = 51426
count=5
Previous | Home | Next |