main:
#int main(void) {
# int x, y;
# printf("First number: ");
# scanf("%d", &x);
# printf("Second number: ");
# scanf("%d", &y);
# printf("%d\n", (x+y)/2);
# return 0;
#}
li $v0, 4 #printf("First number: ");
la $a0, prompt1
syscall
li $v0, 5 # scanf("%d", &x);
syscall
move $t0, $v0 # $t0, x
li $v0, 4 #printf("Second number: ");
la $a0, prompt2
syscall
li $v0, 5 # scanf("%d", &y);
syscall
move $t1, $v0 # $t1, y
add $t2, $t0, $t1 # $t2 = x + y
div $t2, $t2, 2 # $t2 = $t2/2
li $v0, 1 #printf("%d);
move $a0, $t2
syscall
li $v0, 11 # printf("%c", '\n');
li $a0, '\n'
syscall
li $v0, 0
jr $ra
.data
prompt1:
.asciiz "First number: " #char *prompt1 = "First number: "
prompt2:
.asciiz "Second number: "