Take a number as input and reverse the number.

#include <stdio.h>

int main(void)
{
long int num, rev = 0, onum;

printf("\nEnter number : ");
scanf("%ld", &num);

onum = num;

while(num > 0)
{
rev = (rev * 10) + (num % 10);
num /= 10;
}
printf( "\nReverse of %ld is %ld", onum, rev);

return 0;
}

No comments:

Post a Comment

kiss on google ads if you are anonymous because your ip is trackable.thank you.

......from.admin