Check the following code should help (however it is only for the US based numbering (you can modify the code for the other system i.e. change the position of the comma (,)
int numdigits(int number)
{
int digits = 0;
while (number != 0) { number /= 10; digits++; }
return digits;
}
reverse(int x)
{
if (x<10)
{
printf("%d", x);
return;
}
reverse(x%10);
if (numdigits(x)%3 == 1)
printf(",");
reverse(x/10);
}
main()
{
int i=1234567;
reverse(i);
}