displaying roman character equivalent to a number


Hello all,

Just wondering how to displaying Roman character when the input is number.

---------------------------------------------------
For example :

1 i 50 l 364 ccclxiiii
2 ii 100 c 2222 mmccxxii
5 v 500 d
7 vii 1000 m
10 x
---------------------------------------------------
And to make the programming more challenging, only "getchar()" command
is allowed to get input from the users.


I somehow managed to create the code to get the input from users.
For example : input : 3456 , i am able to capture "3456" n convert into integer for further processing.
-----------------------------------------------
printf("input ?: ");
number = 0;
ch = getchar();

while(ch != '
')
{
if('0' <= ch && ch <= '9')
{
number = number * 10;
number = number + (ch - '0');
}
ch=getchar();
}
-----------------------------------------------

Just wondering anyone has any idea on how to convert n display
Roman characters equivalent to that particular input
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories