I believe the answer is D
A function: is a set of commands which can be run by calling it by name.
In Computer programming, a function refers to a group of organized, reusable set of commands (code) that are used to instruct a computer to perform a specific task i.e a single but related action.
Generally, a function receives or accepts data as an input, processes the data and then returns a single result or a set of results as the case may be.
Additionally, the name and arguments contained in a function must always be specified by a function. This makes it possible for a function to be run by a program by calling its name.
Read more: brainly.com/question/23838498
Declare Real lowest, highest, average
Display "Enter the lowest score."
Input lowest
Display "Enter the highest score."
Input highest
Set average = low + high / 2
Display "The average is ", average, "."
Answer:
ion k
Explanation:
The program is supposed to return a hailstone Sequence
A)- get user input (integer) - N
B) check if even or odd
- if the input is even, the next number should N/2
- if the user's input (N*3)+1
C) reproduce the operation on the next number until the number is equal to 1
D) display the sequence
E) count and display the number of iterartion
I have the user input done, and then, I tried to do a bitwise operation using AND to see if the number is even or not but the program doesn't work after the user's input, as i have an output equal to zero
can you help me please?
here is my code so far
.data
prompt: .asciiz "enter an integer:"
message1: .asciiz "you entered an even number"
message2: .asciiz "you entered an odd number"
message3: .asciiz "and the next numbers should be:"
gototheline: .asciiz "\n"
message4: .asciiz "you just entered the number:"
.text
main:
#print the prompt
li $v0,4
la $a0,prompt
syscall
#get the user's input
li $v0,5
syscall
#store the input'svalue
move $t3, $v0
#display the user's input message
li $v0,4
la $a0,message4
syscall
#go to the line
li $v0,4
la $a0,gototheline
syscall
#print value entered by user
li $v0,1
move $a0, $t3
syscall
#go to the line
li $v0,4
la $a0,gototheline
syscall
#bitwise operation on the input
and $a0,$0,1
#call odd function if number is odd
beq $a0,1,ifodd
#print next number message
li $v0, 4
la,$a0,message3
syscall
#go to the line
li $v0,4
la $a0,gototheline
syscall
#print result
li $v0,1
addi $a0,$v1,0
syscall
li $v0,10
syscall
ifeven:
#print message if even
la $a1,message1
syscall
#call the function operation even to do math on the number entered by user
jal operationeven
ifodd:
#print message if odd
la $a2,message2
syscall
#call method to do math on the number entered by user
jal operationodd
operationeven:
#if even N/2
div $v1,$t3,2 # return value on $v1
jr $ra #go back to the main
operationodd:
#multiply by 3
mul $t1,$t3,3
#add 1 to the result of the multiplication
add $v1, $t1,1 #return value on $v1
jr $ra #go back to the main