Questions tagged [roman-numerals]

The Roman numeral system is an ancient way of representing numbers. The symbols are I, V, X, L, C, D and M.

Filter by
Sorted by
Tagged with
4
votes
2answers
117 views

Roman Numbers - The Functional Way

Yet another exercise in converting values between the decimal and roman number systems. I have tried the functional way. Any comments are welcome - but I'm especially interested in answers focusing ...
1
vote
2answers
128 views

Leetcode: Roman digit to integer

I tried to solve the question at https://leetcode.com/problems/roman-to-integer/ i.e Converting an Roman Digit to a Integer using C#. It passes all the test cases but any suggestions to reduce run ...
6
votes
1answer
440 views

Decimal to roman python

I'm a beginner as you can see and I would like to know how I can improve my code. Studying for 6 months now. Thank you. ...
3
votes
2answers
97 views

Number of possible numbers in roman number string

I just started learning programming a few months ago, and I'm intrigued by Haskell. To learn a bit I tried to adapt some code I have in Java so I can see what are equivalent solutions in Haskell. The ...
2
votes
2answers
112 views

Integer to Roman Numerals (1 - 2999)

This is a homework assignment. Convert an integer (1 - 2999) to roman numerals. I was wondering if I could make my code more efficient. The way I have it set up is that I take the digits of the input (...
2
votes
2answers
357 views

Java converter from Arabic to Roman Numerals

I am learning Java and would like to get feedback on the code I wrote. I have written an implementation of an algorithm (found here) for converting any decimal Arabic number to Roman numeral string. ...
3
votes
2answers
392 views

int to Roman numerals in Go / Golang

For a new project, I've started learning Golang. This is one of my very first steps in Go. The objective that I've given myself is to convert int to a String representing the roman numeral of that ...
6
votes
2answers
406 views

Roman_int class in C++

I did the following Excercise from Stroustrups PPP-Book (CH10 EX6) Define a Roman_int class for holding Roman numerals (as int...
15
votes
2answers
3k views

Roman to Integer

I'm trying to get better as a programmer and would love any feedback on my code. Especially the section in the while loop. How could I make this more readable? What would your opinion as an ...
5
votes
1answer
614 views

Roman to Arabic numerals converter in Javascript

I was given some homework as a technical test by a company I wanted to work for... Which I failed to the point of not being able to even access the code review portion of the interviewing process. ...
4
votes
3answers
247 views

Converting from decimals to roman numerals

I've submitted the following code for a job interview, and I wanna know if there is anything I can improve on it, or better ways to do the same thing. ...
3
votes
1answer
114 views

Converting to and from Roman numerals

I wrote a simple Boot script for converting to and from Roman numerals using instaparse. Here's my EBNF grammar (roman.bnf): ...
2
votes
1answer
627 views

Roman numerals to Arabic number

Is there any way to make this for loop more concise or efficient? I fell like there should be a way that you can cahnge the for loop so that it is about half the size that it is know. By the way, the ...
5
votes
1answer
2k views

Number to Roman Numerals in Python

I recently started learning python. Requirements Input: Integer between 1 and 3999 Output: String with Roman numerals I would appreciate it if someone could have look at the code and give me any ...
4
votes
2answers
295 views

Converting an integer to Greek and Roman numerals

Yesterday I posted a question about converting an integer to it's Roman Numeral equivalent. Apparently you guys liked it and gave me some good advice, so I decided to take all your advice, and go a ...
6
votes
2answers
6k views

Convert an integer to its Roman numeral equivalent

I got sent a challenge from a friend; You are given a file that contains numbers, one number per line. Convert the numbers from the file into roman numerals. ...
5
votes
2answers
1k views

Conversion from Roman to decimal numbers

My program makes a conversion between Roman and decimal numbers. Can you give me some advice on how to make it look more readable or to improve in general? Would code extraction of similar-looking ...
11
votes
2answers
5k views

“Merchants Guide to Galaxy” challenge

I have solved the classic "Merchants Guide to Galaxy" problem: A merchant buys and sells items in the galaxy. Buying and selling over the galaxy requires you to convert numbers and units. The ...
6
votes
2answers
4k views

Converting from Roman numerals to Arabic numbers

I got an idea to make a Roman/Arabic number converter, and I would like to hear your thoughts, where I could improve it, if there are Python specific things that I missed, so on and so forth. ...
2
votes
1answer
72 views

Use SRP to refactor this Ruby Class

I have a class, and it does one thing, It adds numerals to the numerals array. In doing so it uses a number of private methods and has ended up looking a little bit sickening... brace yourself... <...
1
vote
1answer
1k views

Convert Integer to Roman Numeral

I've created a function that takes an integer greater than zero as an input and converts it into its corresponding Roman numeral. If you're not familiar with Roman numerals, you can read about it on ...
7
votes
1answer
778 views

Arabic numbers to Roman numerals and back

I have decided to give python a try and have to start out at the very basics, so I chose this well-represented kata. The code aims to convert Arabic numbers between 1 and 3999 to Roman numerals and ...
7
votes
2answers
528 views

A roman to integer converter

For an interview question I made a roman to integer converter: ...
2
votes
0answers
295 views

Roman number converter in Kotlin

I'm learning kotlin and java. As a code-kata I wrote the roman to decimal converter. I'd be very grateful for code review. I was trying to keep things simple and funcional. I'd especially appreciate ...
1
vote
1answer
248 views

Arabic to Roman Number in Ruby on Rails

I am making a class method in ruby to convert from roman number to Arabic and vice versa. However the loop is run to match each character and again to match with roman mapper. Can I optimize the same? ...
6
votes
1answer
577 views

Integer to roman number converter

This is (yet another) integer to Roman numeral converter. To give it a slightly interesting twist, I've implemented this as a num_put facet of a C++ locale, so by ...
5
votes
1answer
447 views

Convert to Roman numerals in Ruby

Challenged by Sandy Metz's newsletter, I've tried to implement this kata from exercism. However, my solution, which passes the tests, is quite a lot simpler than Sandy's solution. Ok, so she's using ...
5
votes
1answer
416 views

Let's revisit Roman numbers

Problem Statement: Write a function to convert from normal numbers to Roman Numerals: e.g. 1 => I 10 => X 7 => VII Code: ...
3
votes
2answers
316 views

Convert Roman Numeral to Arabic

I've been learning Haskell recently and I decided I needed to work on a (somewhat) realistic problem. What I'm most interested in getting feedback on is how well I've used the tools in Haskell to ...
2
votes
2answers
411 views

Arabic numbers to Roman numerals conversion

The following converts Arabic numbers to Roman numerals. I decided to factor each digit into its place value, then use a mapping to convert it to its Roman equivalent. For example, 1997 is factored ...
2
votes
0answers
3k views

Roman numeral converter project

I have a project that is due for my Intro to Java course which requires me to translate the number range of 1 - 3999 into Roman numeral form. If the number I pick is 0 it will end my program, anything ...
3
votes
2answers
687 views

Converting decimal to Roman numerals using MATLAB

I have written a MATLAB function that converts decimals into Roman numerals. ...
5
votes
0answers
212 views

Roman numerals in Haskell

I have written a module that provides some functions for dealing with Roman numerals. I would like some feedback concerning my style, potential performance or elegance improvements, and any ...
8
votes
1answer
356 views

Roman numerals with ANTLR

I've written a simple interpreter with ANTLR for evaluating Roman numerals. Here's the contents of the grammar file (Roman.g4): ...
11
votes
3answers
2k views

Number to Roman numerals

I've been working on numerals conversion lately. Now the JavaScript course I'm following asked me to do something similar for Roman numerals. To keep things fresh and given the amount of test-cases ...
12
votes
1answer
5k views

Roman Numerals in Java

I wrote a class that can convert to and fro from Roman Numerals and Decimals. I would appreciate critical points on everything, especially: Shortening my code. Choosing a better approach. Using ...
1
vote
2answers
967 views

Decimal to Roman numeral conversion algorithm

I have written a program to convert a decimal to a Roman numeral. I am wondering if my algorithm is okay or not. If it's not okay, I want suggestions on improving my code. This code only works for ...
8
votes
1answer
963 views

Integer to Roman Numeral converter

I have implemented an Integer to Roman Numeral converter that converts any number in the range \$[1 \le x \le4999]\$ to its Roman number equivalent. Any comments on improving my code style or ...
7
votes
3answers
4k views

Checking for Roman numeral validity

I am working on a Roman numerals calculator. For an input validity test I'm using this function: ...
2
votes
1answer
102 views

Number to Roman in Javascript

Is this a good solution for the Number to Roman Numerals Kata in Javascript? ...
3
votes
3answers
5k views

Roman Numerals - the good, the bad, and the ugly

I wrote a RomanNumeral class in C#. Please pull it to pieces: ...
8
votes
3answers
1k views

Adding two roman-numeral inputs

This is the first coding class I've taken and I'm not getting much feedback from the instructor. The function of this program is to take two roman numeral inputs, convert them to arabic, add them ...
6
votes
2answers
395 views

Roman numeral to decimal converter

Program written in TI-Basic that works on TI-83/84/+/SE calculators. Automatically detects whether input is a number of a Roman numeral, and converts to the opposite. Please try to optimize for size, ...
5
votes
1answer
1k views

Converting to Roman Numeral with Recursive Algorithm

Summary I'm getting ready to dive back into a "more proper" project, so I wanted to take a moment to get my TDD hat on before doing so. I decided to tackle this Roman Numeral Kata for practice. The ...
6
votes
2answers
5k views

Convert Roman to Int

I made a function that converts Roman letters to integers. But I'm not happy with it, as I feel like I used too much code for a such a simple task. Any suggestion on how I can minimize it? ...
6
votes
2answers
2k views

Positive integer to Roman Numeral conversion function

For the past two hours I was searching for a built-in function for converting an integer to an equivalent Roman numeral, but it failed to achieve the target. Hence I wrote my own routine for ...
2
votes
2answers
8k views

Number to Roman Numeral

...
15
votes
2answers
10k views

Roman numerals to decimal

This is a program for converting Roman numerals to their decimal equivalents. There must be a better way of distinguishing between, for example, 'IV' and 'VI', than what I have currently written. <...
4
votes
2answers
1k views

Roman numeral converter in Ruby

For a Project Euler problem, I made a Ruby roman numeral converter: ...
10
votes
1answer
426 views

Roman numeral kata in Elixir

I'm new to Elixir, and in order to learn the syntax, I'm doing a roman numeral kata which converts a decimal number into roman numeral. I would appreciate any feedback you have. ...