Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .data
- prompt: .asciiz "Enter your age: "
- message: .asciiz "\nYour age is "
- msg1: .asciiz "\nNemojs da pies gin tonic."
- msg2: .asciiz "\nMojs da pies gin tonic"
- .text
- #Prompt the user to enter age.
- li $v0, 4
- la $a0, prompt
- syscall
- # Get the user's age
- li $v0, 5 # scanf za integer
- syscall
- # Store the result in $t0
- move $t0, $v0
- bge $t0, 18 label1 # ako t0 e => skokni vo label 1
- # ako ne e tocen uslovot izvrsi go ova nadolui
- # Display message
- li $v0, 4
- la $a0, message
- syscall
- # Print the age
- li $v0, 1
- move $a0,$t0
- syscall
- li $v0, 4
- la $a0, msg1
- syscall
- j end
- label1:
- # Display message
- li $v0, 4
- la $a0, message
- syscall
- # Print the age
- li $v0, 1
- move $a0,$t0
- syscall
- li $v0, 4
- la $a0, msg2
- syscall
- j end
- end:
- li $v0, 10
- syscall
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement