Lab 1:

scrennshotlab1

Objective:
The objective of this lab experiment was to create a code that creates a Roman Numeral value for the input value entered.

program Romanf13;
#include("stdlib.hhf")
static
	x: int32;
begin Romanf13;
	stdout.put("Enter decimal: ");
	stdin.get(x);
	mov(x, eax);
	while(eax > 0) do
		if(eax >= 100) then
			stdout.put("C");
			sub(100, eax);
		elseif(eax >= 99) then
			stdout.put("IC");
			sub(99, eax);
		elseif(eax >= 90) then
			stdout.put("XC");a
			sub(90, eax);
		elseif(eax >=50) then
			stdout.put("L");
			sub(50, eax);
		elseif(eax >= 49) then
			stdout.put("IL");
			sub(49, eax);
		elseif(eax >= 40) then
			stdout.put("XC");
			sub(40, eax);
		elseif(eax >= 10) then
			stdout.put("X");
			sub(10, eax);
		elseif(eax >= 9) then
			stdout.put("IX");
			sub(9, eax);
		elseif(eax >=5) then
			stdout.put("V");
			sub(5, eax);
		elseif(eax>=4) then
			stdout.put("IV");
			sub(4, eax);
		elseif(eax >= 1) then
			stdout.put("I");
			sub(1, eax);
		endif;
	endwhile;
stdout.put(nl);
end Romanf13;

Leave a Reply

Your email address will not be published. Required fields are marked *