(num: i32)
| 1 | pub fn int_to_roman(num: i32) -> String { |
| 2 | let mut num = num; |
| 3 | let values = vec![1000,900,500,400,100,90,50,40,10,9,5,4,1]; |
| 4 | let reps = vec!["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]; |
| 5 | let mut ret = String::new(); |
| 6 | for i in 0..13 { |
| 7 | while num >= values[i] { |
| 8 | num -= values[i]; |
| 9 | ret.push_str(reps[i]); |
| 10 | } |
| 11 | } |
| 12 | ret.to_string() |
| 13 | } |
| 14 | |
| 15 | fn main() { |
| 16 | let num = 1994; |
nothing calls this directly
no outgoing calls
no test coverage detected