# example as C program code # int a, x; # System.out.print("Number x to add?\n"); # Scanner sc = new Scanner(System.in); # x = sc.nextInt(); # a = 10 + x; # System.out.print("Sum of 10 + x is\n"); # System.out.print(a); # the code below carries out the above # .data x_msg: .asciiz "Number x to add?\n" msg: .asciiz "Sum of 10 + x is\n" .text li $v0,4 # print prompt la $a0,x_msg syscall li $v0,5 # get value (x) syscall move $t0,$v0 # put x into a addi $t0,$t0,10 # add 10 to x li $v0,4 # print output string la $a0,msg syscall li $v0,1 # print a add $a0,$t0,$0 syscall li $v0,10 # terminate syscall