Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

* PLEASE SOLVE THE EXERCISE BY MIPS ASSEMBLY *PLEASE SOLVE AS COMPUTER TYPING (NOT HAND WRITING) *PLEASE SOLVE AS COMPUTER TYPING (NOT HAND WRITING) Exercise

*PLEASE SOLVE THE EXERCISE BY MIPS ASSEMBLY

*PLEASE SOLVE AS COMPUTER TYPING (NOT HAND WRITING)

*PLEASE SOLVE AS COMPUTER TYPING (NOT HAND WRITING)

Exercise

Write a program to find the largest of 3 numbers.

Write a program to find the smallest of 3 numbers.

Ex1- Solution:

.data

message: .asciiz " the greatest number "

mg1:.asciiz "Enter first number: "

mg2:.asciiz "Enter second number: "

mg3:.asciiz "Enter third number: "

.text

main:

li $v0,4

la $a0,mg1

syscall

li $v0,5

syscall

move $s0,$v0 #first number in s0

li $v0,4

la $a0,mg2

syscall

li $v0,5

syscall

move $s1,$v0 #second number in s1

li $v0,4

la $a0,mg3

syscall

li $v0,5

syscall

move $s2,$v0 #third number in s2

bgt $s0, $s1,L1

bgt $s1, $s2, NumberTwo

j NumberThree

L1:

bgt $s0,$s2, NumberOne

j NumberThree

NumberOne: # number one is the greatest

li $v0,1

move $a0, $s0

syscall

j End

NumberTwo: # number two is the greatest

li $v0,1

move $a0, $s1

syscall

j End

NumberThree:

li $v0,1 # number three is the greatest

move $a0, $s2

syscall

j End

End:

li $v0,4

la $a0,message

syscall

#End of main

li $v0,10

syscall

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management Systems Designing And Building Business Applications

Authors: Gerald V. Post

1st Edition

0072898933, 978-0072898934

More Books

Students also viewed these Databases questions