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"};
}
|