#second method to solve .data arithmos: .asciiz "dose arithmo " thetikos: .asciiz "einai thetikos " arnitikos: .asciiz "einai arnitkos " zero: .asciiz "einai miden" .text .globl main main: # the user enter the number addi $v0,$0,4 #(li $v0,4) la $a0, arithmos syscall #get the number addi $v0,$0,5 syscall #store the result in t0 move $t0,$v0 #check if number is zero beq $t0,$0,label_zero #check if number is negative slt $t1,$t0,$0 #t1 = 1 if $t0<0 bne $t1,$0, label_negative #if $t1==1, go to label_negative #if it is not zero or negative, is positive la $a0, thetikos j print_message #load neggstive message label_negative: la $a0, arnitikos j print_message #load zero message label_zero: la $a0, zero #print the string print_message: addi $v0,$0,4 syscall li $v0,10 #exit syscall