REVERSE NUMBER
Code :
#include<stdio.h>
int main()
{
int num,rem=0, rev=0;
printf("=======================================\n");
printf("\t REVERSE NUMBER\n");
printf("=======================================\n");
printf("Enter any number to reverse: ");
scanf("%d", &num);
while(num!=0)
{
rem = num%10; //This is get reminder of num
rev = rev * 10 + rem; //addding in reverse
num /= 10; //dividing num
}
printf("\nReverse number : %d\n", rev);
printf("---------------------------------------\n");
return 0;
}
Come again Learn again !
« iCodeBuzz »
No comments:
Post a Comment