1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Flauer [41]
3 years ago
10

1.8.1: Compute an expression. Write a statement that assigns finalResult with the sum of num1 and num2, divided by 3. Ex: If num

1 is 4 and num2 is 5, finalResult is 3.
Computers and Technology
1 answer:
Natasha_Volkova [10]3 years ago
5 0

Answer:

finalResult = (num1 + num2 ) / 3

Explanation:

finalResult, num1 and num2 are all variables and it is assumed that they have all been declared with their correct data types.

finalResult is said to be the result of the sum of the two other variables, num1 and num2 divided by 3.

i.e

(num1 + num2) / 3

<em>Note </em>: It is essential to put the sum of num1 and num2 in bracket so as to ensure that the addition operation is performed first before the division operation. Not putting in bracket will make the division operation to be performed first which will not be the solution to the problem at hand.

Once the operations (addition and division) have been performed, then the result is assigned to the variable, finalResult, as follows:

finalResult = (num1 + num2 ) / 3         --------- (1)

Therefore, if num1 = 4 and num2 = 5, finalResult according to the equation(1) above gives;

finalResult = (4 + 5) / 3

finalResult = 9 / 3

finalResult = 3

<em>Hope this helps!</em>

You might be interested in
55555,5555,555,55,5​
REY [17]

Answer: Decreasing Function????????????????????????????????

Explanation:

I'm confused, but I'm still gonna try and answer

6 0
3 years ago
Can a user account be used to log in to the system before its password is set?
-Dominant- [34]
No it can not it needs to have a password to log in.
6 0
3 years ago
Read 2 more answers
(Assignment 1, individual) Create proc3.s Study the proc3.c and re-write the same program in MIPS with the following requirement
Vedmedyk [2.9K]

Answer:

text

.globl main

main:

li $s0,5 #load 5 to x

li $s1,10 #load 10 to y

move $a0,$s0

move $a1,$s1 #passing argument to sum function

jal sum

add $s1,$s1,$v0 #get y + sum(x,y)

add $s1,$s1,$s0 #get x+ y + sum(x,y)

li $v0,1

move $a0,$s1

syscall #print value of y

li $v0,10 #terminate call

syscall

sum:

addi $sp, $sp, 4

subu $sp,$sp,4 # point to the place for the new item,

sw $ra,($sp) # store the contents of $ra as the new top.

move $t1, $a0 #store parameters m

move $t2, $a1 #store parameters n

add $a0,$t2,1 #get n+1

add $a1,$t1,1 #get m+1

jal sub

move $t3,$v0 #store result to t3

sub $a0,$t1,1 #get m-1

sub $a1,$t2,1 #get n-1

jal sub

move $t4,$v0 #store result to t3

add $v0,$t3,$t4 #return p+q

lw $ra,($sp) # store the contents of $ra as the new top.

addu $sp,$sp,4 # point to the place for the new item,

addi $sp, $sp, 4

jr $ra

sub:

sub $v0,$a1,$a0 #return b-a

jr $ra

Explanation:

text

.globl main

main:

li $s0,5 #load 5 to x

li $s1,10 #load 10 to y

move $a0,$s0

move $a1,$s1 #passing argument to sum function

jal sum

add $s1,$s1,$v0 #get y + sum(x,y)

add $s1,$s1,$s0 #get x+ y + sum(x,y)

li $v0,1

move $a0,$s1

syscall #print value of y

li $v0,10 #terminate call

syscall

sum:

addi $sp, $sp, 4

subu $sp,$sp,4 # point to the place for the new item,

sw $ra,($sp) # store the contents of $ra as the new top.

move $t1, $a0 #store parameters m

move $t2, $a1 #store parameters n

add $a0,$t2,1 #get n+1

add $a1,$t1,1 #get m+1

jal sub

move $t3,$v0 #store result to t3

sub $a0,$t1,1 #get m-1

sub $a1,$t2,1 #get n-1

jal sub

move $t4,$v0 #store result to t3

add $v0,$t3,$t4 #return p+q

lw $ra,($sp) # store the contents of $ra as the new top.

addu $sp,$sp,4 # point to the place for the new item,

addi $sp, $sp, 4

jr $ra

sub:

sub $v0,$a1,$a0 #return b-a

jr $ra

The above program takes in Local variables mapping: main(): x -> $s0, y -> $s1 b. sum(): p -> $s0, q -> $s1 Then Input arguments mappings: sum(): m -> $a0, n-> $a1 b. sub(): a -> $a0, b-> $a1

And return all values from a function which must be stored in V registers in ascending order.

8 0
3 years ago
Which of the following is a primary responsibility of the Federal Reserve Bank?
nadya68 [22]
D. Print Money.

pls brainliest.
6 0
4 years ago
Read 2 more answers
Your systems analysis team is close to completing a system for Azuka Theatre. Kevin is quite con- fident that the programs he ha
zubka84 [21]

Answer:

a

Explanation:

im smart

3 0
3 years ago
Other questions:
  • Compare and contrast the TwoFish encryption algorithm with the DES and AES algorithms. In your comparison be sure to compare and
    6·1 answer
  • Which program or security application prevents access between a private and trusted network, and other untrusted networks?
    8·2 answers
  • By default, the document has a (blank) margin on all four sides
    11·2 answers
  • Describe the effect of a pull up resistor
    7·1 answer
  • Where could an identity theft access your personal information
    9·2 answers
  • The main disadvantage of using this device is its negative impact on network performance,resulting from the fact that any incomi
    10·1 answer
  • The browser feature which enables tabs to work independently from one another so if one crashes, the others may continue to work
    6·1 answer
  • On tool hackers use to get sensitive information from victims is/are:
    15·2 answers
  • Características que debe tener un módulo o kit tecnológico para aprender​
    14·1 answer
  • How would a barcode reader be used in a healthcare industry?​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!