I've written this program in C that asks for an integer input and outputs the numbers in reverse order. I need to cut the loop out of it into a separate function that is called upon, but I'm having trouble getting it to work. Any suggestions about how to make a function out of a part of the code?
#include <stdio.h>
int main( void )
{
int num, mod, rev = 0;
printf("\n");
printf("Enter an Integer Between 1 - 10,000: ");
scanf("%d", &num);
printf("\n");
while( num > 0)
{
mod = num %10;
rev = (rev * 10) +mod;
num = num / 10;
}
printf(" The Reverse of the Integer is: %d\n", rev);
return 0;
}