I cant check if this is write as I have to do it at school. But I wanted to know if you can read over for me.

This is my multiplication

add       $s2, $zero, $zero
                add       $t0, $zero, $zero

LOOP:           beq       $t0, $s0, EXIT
                add       $s2, $s1, $s2
                addi       $t0, $t0, 1

EXIT:

Okay it takes two integers stores them in $s0 and $s1

$s2 is a registry will be the product
$t0 is the increment

It suppose to loop until the values of $t0 = $s0

$s2 should equal the product of $s0 and $s1

add       $t2, $s0, $zero
                add       $t0, $zero, $zero

LOOP:           bne       $t0, $s0, EXIT
                beq       $s1, $zero, DividebyZero
                beq       $s0, $zero, AnsZero

                sub       $t2, $t2, $s1
                beq       $t2, $zero, ANS
                addi       $t0, $t0, 1
                j Loop



DividebyZero:


AnsZero:


ANS:


EXIT:

This one I am not sure what I am doing. I wrote the code in C++ first and came up with this.

#include <iostream>
using namespace std;

int main(){

	int i = 0;
	int num1, num2;

	cout << "Enter Number 1" << endl;
	cin >> num1;

	cout << "Enter Number 2" << endl;
	cin >> num2;




	int x = num1;
	while(i != num1)
	{


	if(num2 == 0){
		cout << "Divsion by Zero" << endl;
		return 0;
	}
		
		x -= num2;

		if(x <= 0)
		{
				cout << num1 << " / " << num2 << " " << i << endl;
				return 0;
		}
				i++;
	}

			if (num1 == 0){
		cout << " 0 " << endl;
		return 0;
	}

}

$s0 and $s1 are still the numbers as they were before
$t0 is the increment number

Didnt see an edit button so I got to double post.

I think I did everything, if some can test and point errors that would be great :)

.data

str1:		.asciiz "Enter the first integer: "
str2:		.asciiz "Enter the second integer: "
str3:		.asciiz "Multiplication: "
str4:		.asciiz "Division: "
str5:		.asciiz "Division by zero"
newline:	.asciiz "\n"

			.text
main:		addi $v0, $zero, 4
			la   $a0, str1
			syscall

			addi $v0, $zero, 5
			syscall 
			add  $s0, $zero, $v0

			addi $v0, $zero, 4
			la   $a0, str2
			syscall

			addi $v0, $zero, 5
			syscall 
			add  $s1, $zero, $v0

			add  $s2, $zero, $zero				# Multiplication Start
			add  $t0, $zero, $zero
Loop:		beq  $t0, $s0, MEXIT
			add  $s2, $s1, $s2
			addi $t0, $t0, 1
MEXIT:

			addi $v0, $zero, 4
			la   $a0, str3
			syscall

			addi $v0, $zero, 1
			add   $a0, $zero, $s2
			syscall

			addi $v0, $zero, 4
			add   $a0, newline
			syscall
			
						
			add  $t2, $s0, $zero				# Division Start
			add  $t1, $zero, $zero
			beq  $s0, $zero, ANSZERO
DLoop:		bne  $t1, $s0, EXIT
			beq  $s1, $zero, DivideByZero

			sub  $t2, $t2, $s1
			addi $t1, $t1, 1
			beq  $s2, $zero, ANS
			j DLoop

ANSZERO:
			addi $v0, $zero, 4
			la   $a0, str4
			syscall

			addi $v0, $zero, 1
			add   $a0, $zero, $t1
			syscall
			j EXIT


DivideByZero:
			addi $v0, $zero, 4
			la   $a0, str5
			syscall
			j Exit


ANS:
			addi $v0, $zero, 4
			la   $a0, str4
			syscall

			addi $v0, $zero, 1
			add   $a0, $zero, $s2
			syscall
			j EXIT


EXIT:
			addi $v0, $zero, 4
			add   $a0, newline
			syscall

			addi $vo, $zero, 10
			syscall
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.