Task3_Console

PHOTO EMBED

Mon May 01 2023 20:54:59 GMT+0000 (Coordinated Universal Time)

Saved by @Youssef_Taj

.data
F.No: .asciiz "Enter the first number: "
S.No: .asciiz "Enter the second number: "
Th.No: .asciiz "Enter the third number: "
Output: .asciiz "The greatest number is: "
 
.text
 
    # Ask user to input the first number
    li $v0, 4
    la $a0, F.No
    syscall
 
    # Read the first number from user input
    li $v0, 5
    syscall
    move $s0, $v0
 
    # Ask user to input the second number
    li $v0, 4
    la $a0, S.No
    syscall
 
    # Read the second number from user input
    li $v0, 5
    syscall
    move $s1, $v0
 
    # Ask user to input the third number
    li $v0, 4
    la $a0, Th.No
    syscall
 
    # Read the third number from user input
    li $v0, 5
    syscall
    move $s2, $v0
 
    # Find the greatest of the three numbers
    move $t0, $s0
    blt $s1, $t0, greater_than_num1
    move $t0, $s1
 
greater_than_num1:
    blt $s2, $t0, greater_than_num2
    move $t0, $s2
 
greater_than_num2:
    # Print the result
    li $v0, 4
    la $a0, Output
    syscall
 
    li $v0, 1
    move $a0, $t0
    syscall
 
    # Exit the program
    li $v0, 10
    syscall
content_copyCOPY