Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I'm trying to print the largest of the three numbers. how can i correct this program 0101 Edit Execute compare 3 numbers print larger.asm #print
I'm trying to print the largest of the three numbers. how can i correct this program
0101 Edit Execute compare 3 numbers print larger.asm #print larger of 2 numbers # compare #print larger #exit , text 6 main: li svo, 5 #accept 1st num 8 syscall 9 move StO, SvO number a 10 li svo,5 11 syscall 12 move sti,svo #number b 13 i Svo, 5 14 syscall 15 move St. 2 , Svo #numberc 16 17 #compare a and b 18 bgt sto, sti, larger #iatger can be any name / bot-a>b "to> t 1 19 move St3 , St1 #print b if a is not greater than b 20 b endif#exit from else it 21 22 larger: #condi tion is true 23 move St3,sto 24 endif: 25 26 bgt $t2, $L3, largest #compare a,b to c 27 move SL4, St2 #accept 2nd num StI accept third number. r ab Jarger print Line: 32 Column: 7 Show Line Numbers Edit Execute compare 3 numbers print larger.asm 12 move $t1, v0 number h 13 li $v0, 5 14 syscall 15 move $t2, $v0 #number 16 17 #compare a and b 18 bgt Sto, stl, larger #larger ca n be any name/bot 19 move $t3,St1 #print b if a is not greater than b 20 b endif #exit from else i! St1 b accept third number asb "ostu 21 22 larger: #condition is true 23 move $t3,$to 24 endif: 25 26 bat St2, St3, largest #compare a,b to c 27 move $t4, St2 28 b endif 29 30 largest: 31 move $t4, t3 32 endifl: # if ab larger print else c larger 34 move Sa0'St4 #put result into a0 35 ISv0,1 36 syscall 37 li $v0, 10 38 syscall fprint integer exit program Line: 32 Column: 7 Show Line Numbers Tyne here to searchStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started