"MIPS power function" Code Answer's
You're definitely familiar with the best coding language Whatever that developers use to develop their projects and they get all their queries like "MIPS power function" answered properly. Developers are finding an appropriate answer about MIPS power function related to the Whatever coding language. By visiting this online portal developers get answers concerning Whatever codes question like MIPS power function. Enter your desired code related query in the search bar and get every piece of information about Whatever code related question on MIPS power function.
MIPS power function
.data
str1: .asciiz "Give integer X from 1 to 20 "
str2: .asciiz "Give integer Y from 0 to 5 "
errormsg: .asciiz "Out of range.\n"
nline: .asciiz "\n"
result1: .asciiz " raised to "
result2: .asciiz " gives: "
.text
error:
li $v0,4 #print string1
la $a0,errormsg
syscall
beq $s2,$zero,getX
j getY
.globl main
main:
addi $s0,$zero,21 #s0=21
addi $s1,$zero,6 #s1=6
getX:
addi $s2,$zero,0 #s2=0 to input x and 1 to input y
li $v0,4
la $a0,str1
syscall #print string1
li $v0,5
syscall #read int
slt $s3,$v0,$s0 #$s3=($v0<$s0) if(x<21) $s1=1
beq $s3,$zero,error #if $s3=0 goto error
blez $v0,error #if ($v0<=0) goto error
move $t0,$v0
getY:
addi $s2,$zero,1
li $v0,4
la $a0,str2
syscall #print string2
li $v0,5
syscall #read int
slt $s3,$v0,$s1 #$s3=($v0<$s1) if(x<6) $s3=1
beq $s3,$zero,error #if $s3=0 goto error
bltz $v0,error #if ($v0<0) goto error
move $t1,$v0
beq $t1,$zero,else #if (t1=0) t2=1, t1=y,t2=result
addi $t2,$zero,1
addi $s4,$zero,0
loop: #if s4<t1
slt $s5,$s4,$t1 #$s5=($s4<$t1) if(x<21) $s5=1
beq $s5,$zero,printresult
#if $s1=0 goto printresult(s4=t1)
mul $t2,$t2,$t0 #t2=t2*t0
addi $s4,$s4,1
j loop
else:
addi $t2,$zero,1
j printresult
printresult:
li $v0,1
move $a0,$t0
syscall #print X
li $v0,4
la $a0,result1
syscall #print " raised to "
li $v0,1
move $a0,$t1
syscall #print Y
li $v0,4
la $a0,result2
syscall #print " gives "
li $v0,1
move $a0,$t2
syscall #print result(t2)
li $v0,10
syscall #exit
Source: akomaenablog.blogspot.com
All those coders who are working on the Whatever based application and are stuck on MIPS power function can get a collection of related answers to their query. Programmers need to enter their query on MIPS power function related to Whatever code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about MIPS power function for the programmers working on Whatever code while coding their module. Coders are also allowed to rectify already present answers of MIPS power function while working on the Whatever language code. Developers can add up suggestions if they deem fit any other answer relating to "MIPS power function". Visit this developer's friendly online web community, CodeProZone, and get your queries like MIPS power function resolved professionally and stay updated to the latest Whatever updates.