Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

EXERCISE - INDIVIDUAL: MIPS Grading In the files for this lab, you have been given grade. s, a MIPS assembler program which reads a number

image text in transcribedimage text in transcribedimage text in transcribed
EXERCISE - INDIVIDUAL: MIPS Grading In the files for this lab, you have been given grade. s, a MIPS assembler program which reads a number and always prints FL: $ 1521 mipsy grade. s Enter a mark: 100 FL Add code to grade. s to make it equivalent to this C program: // read a mark and print the corresponding UNSW grade #include int main(void) { int mark; printf("Enter a mark: ") ; scanf("%d", &mark) ; if (mark int main(void) { int x; printf ("Enter a number: "); scanf ("%d", &x) ; if ( (x & 1) = = 0) { printf ("Even\ "); } else { printf ("Odd\ "); return 0; dd_even.simple.c #include int main(void) { int x, v0; printf("Enter a number: "); scanf ("%d", &x) ; ve = x & 1; if (ve == 1) goto odd; printf ("Even\ ") ; goto end; odd : printf ("Odd\ "); end : return 0; dd_even.s ad a number and print whether its odd or even main : la $20, stringe # printf("Enter a number: "); li $v0, 4 syscall li $vo, 5 # scanf("Xd", x) ; syscall and $to, $ve, 1 # if (x & 1 = = 0) { beq $te, 1, odd la $20, string1 # printf("Even \ "); li $v0, 4 syscall b end odd : # else la $a0, string2 # printf("odd\ "); li $v0, 4 syscall end: li $VO, 0 # return 0 jr $ra . data stringe: . asciiz "Enter a number: string1: . asciiz "Even\ " string2: asciiz "Odd\ "*grade.s xx 1 # read a mark and print the corresponding UNSW grade main : la $a0, prompt # printf ("Enter a mark: ") ; li $VO, 4 syscall 8 li $vo, 5 # scanf ("%d", mark) ; syscall 10 11 la $a0, fl # printf ("FL\\"); 12 li $VO, 4 13 syscall 14 15 16 jr $ra # return 17 18 . data 19 prompt : 20 asciiz "Enter a mark: " 21 fl: 22 . asciiz "FL\\" 23 ps : 24 asciiz "PS\ " 25 cr: 26 . asciiz "CR\ " 27 dn: 28 . asciiz "DN\ " 29 hd : 30 . asciiz "HD\ "

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions