Trouble with integer string in printf()?

Lines 26-28 should be printing out digits of the inputted number separated by commas (i.e Input: 2345, Output: Digits of the number: 2, 3, 4, 5)

However, my code prints: Digits of the number: 2, Digits of the number: 3, Digits of the number: 4, Digits of the number: 5

This program is supposed to convert arabic numbers into roman numerals. I believe my next step will be creating a switch, but I'm not sure. This is one of my first few programs so any help would be appreciated.
Thanks.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <stdio.h>
#include <string.h>

void dig_to_roma(int n, char *T, char *b, char *c, char*d);

int main(void)
{
int n, i;
int pos = 0, digit[10];

error1:

	printf("Enter a number (between 1 and 3999): ");
	scanf("%d", &n);
	if(n < 1 || n > 3999){
	printf("\nERROR: Number must be between 1 and 3999\n");
	goto error1;
	}

	while (n > 0){
	i = n % 10;
	digit[++pos] = i;
	n = n / 10;
	}

	while(pos)
	{printf("Digits of the number: %d, " , digit[pos--]);
	}
	return 0;
}

void dig_to_roma(int n, char *T, char *b, char *c, char*d)
{
	char *thou[] = {" ", "M", "MM", "MMM"};
	char *hund[] = {" ", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"};
	char *tens[] = {" ", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "LC"};
	char *ones[] = {" ", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"};
}
Topic archived. No new replies allowed.