Thread: how do i display a roman numerals from ordinary numbers??

1. Converting 9 is easy, because you only have to deal with one digit. A look up table does the trick.

A more instructive example is converting a number like 909. In this case you must first convert the 900, then deal with the remainder. So 909 is CM followed by the converted form of 9.

2. yes..i thought that your getting what i mean whiteflags??
But the important thing is, are you getting what I mean? It doesn't matter if I understand it. You are the student here.

then what kind of operators i will use..??
From my example, we see the numbers getting smaller so you will have to subtract the value of the numerals you write down from the number you convert each time. Then you append the numeral to the string. If you don't know strings, you need to learn their basic usage before attempting this. You also need first grade math skills.
when i write a algorithm flowchart and solution..can you give a example code??
Sample code, for a problem like this, is as good as solution code. I will not give a working sample of this problem. After you get some work done, I will be happy to correct your work.

when converting 9??i will use it as a guidelines..
You need to save the digits answers in memory. Eventually you'll get to single digits and it will be the easiest thing to append to the answer.

3. Originally Posted by King Mir
A more instructive example is converting a number like 909. In this case you must first convert the 900, then deal with the remainder. So 909 is XC followed by the converted form of 9.
Especially instructive since it's either CMIX, DCDIX, or DCCCCIX....

4. How many times we must repeat this? First you make a flowchart! Forget all about coding! Forget all about headers, operators, if statements, switch cases, etc.
Do we need an algorithm to write a flowchart? No.
Can we deduce an algorithm from a flowchart? Yes.

How does one write a flowchart, then? One starts doing the mental exercise by hand and writing down the steps one takes.
If you cannot do that, then you are beyond help.

5. Originally Posted by Elysia
Do we need an algorithm to write a flowchart? No.
I would say "yes", since a flowchart is a way to express an algorithm. You cannot express what you don't have. The point though is that a flowchart (or my preference: pseudocode) allows you to express an algorithm without caring about the specifics of programming language syntax or other nitty gritty details that you have to take care of to have a correct program.

6. Clearly arguable, but what I mean to say is that you don't need to know an algorithm beforehand to start writing a flowchart. A flowchart is best at making up an algorithm as you go.

7. Originally Posted by Elysia
OK, so your second thread was closed because you already have a thread on the subject.
And as we have said, forget all about if statements / switch cases, operators, etc. Focus on a flow chart first.
And when you've done that, show us what you've accomplished so far and ask specific questions about what you are having trouble with.
That's it.

Popular pages Recent additions