Skip to content

Commit 6135876

Browse files
committed
readme updated
1 parent e5c3e0e commit 6135876

File tree

4 files changed

+47
-0
lines changed

4 files changed

+47
-0
lines changed
Loading
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<b>This is the basic program to convert integer to roman numeral</b>
2+
<br>
3+
<b>Built with</b><br>
4+
-Python<br>
5+
-No module needed<br>
6+
<b>Aim</b><br>
7+
The aim of the program is to convert integer to roman numerals.<br>
8+
<b>Workflow</b><br>
9+
<br>
10+
<b>Step 1:</b> Integer number is taken as input should be less than 3999.<br>
11+
<br>
12+
<b>Step 2:</b> Two list {symbol} and {value} <br>
13+
{symbol} having roman of each integer in list {value}<br>
14+
<br>
15+
<b>Step 3:</b> check the the range of value<br>
16+
divide the number with all values in list {value} starting from zero.<br>
17+
<br>
18+
<h4>Screenshot of the Python script</h4>
19+
![Screenshot (93)](https://user-images.githubusercontent.com/81240664/122437283-3334df80-cfb7-11eb-9f4e-e9d169762c8e.png)
20+
<br>
21+
<h4>Author</h4>
22+
<b>Pratima Kushwaha</b>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
def roman_number(num):
2+
if num > 3999:
3+
print("enter number less than 3999")
4+
return
5+
#take 2 list symbol and value symbol having roman of each integer in list value
6+
value = [1000,900,500,400,100,90,50,40,10,9,5,4,1]
7+
symbol = ["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]
8+
roman = ""
9+
i=0
10+
while num>0:
11+
#then we have to check the the range of value
12+
#divide the number with all values starting from zero
13+
div = num//value[i]
14+
#mod to get part of number
15+
num = num%value[i]
16+
while div:
17+
roman = roman+symbol[i]
18+
#loop goes till div become zero
19+
div = div-1
20+
i=i+1
21+
return roman
22+
23+
num = int(input("enter an integer number: "))
24+
print(f" Roman Numeral of {num} is {roman_number(num)}")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<b> As it is the simple python script doesn't need any library to be imported. </b>

0 commit comments

Comments
 (0)