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
Bas_tet [7]
3 years ago
9

What is output? public class MathRecursive { public static void myMathFunction(int a, int r, int counter) { int val; val = a*r;

System.out.print(val+" "); if (counter > 4) { System.out.print("End"); } else { myMathFunction(val, r, counter + 1); } } public static void main (String [] args) { int mainNum1 = 1; int mainNum2 = 2; int ctr = 0; myMathFunction(mainNum1, mainNum2, ctr); } }
a) 2 4 8 16 32 End
b) 2 2 2 2 2
c) 2 4 8 16 32 64 End
d) 2 4 8 16 32
Computers and Technology
1 answer:
ycow [4]3 years ago
3 0

Answer:

The output of the program is:

2 4 8 16 32 64 End

Explanation:

See attachment for proper presentation of the program

The program uses recursion to determine its operations and outputs.

The function is defined as: myMathFunction(int a, int r, int counter)

It initially gets the following as its input from the main method

a= 1; r = 2; counter = 0

Its operation goes thus:

val = a*r; 1 * 2 = 2

Print val; Prints 2

if (counter > 4) { System.out.print("End"); } : Not true

else { myMathFunction(val, r, counter + 1); }: True

The value of counter is incremented by 1 and the function gets the following values:

a= 2; r = 2; counter = 1

val = a*r; 2 * 2 = 4

Print val; Prints 4

else { myMathFunction(val, r, counter + 1); }: True

The value of counter is incremented by 1 and the function gets the following values:

a= 4; r = 2; counter = 2

val = a*r; 4 * 2 = 8

Print val; Prints 8

else { myMathFunction(val, r, counter + 1); }: True

The value of counter is incremented by 1 and the function gets the following values:

a= 8; r = 2; counter = 3

val = a*r; 8 * 2 = 16

Print val; Prints 16

else { myMathFunction(val, r, counter + 1); }: True

The value of counter is incremented by 1 and the function gets the following values:

a= 16; r = 2; counter = 4

val = a*r; 16 * 2 = 32

Print val; Prints 32

else { myMathFunction(val, r, counter + 1); }: True

The value of counter is incremented by 1 and the function gets the following values:

a= 32; r = 2; counter = 5

val = a*r; 32 * 2 = 64

Print val; Prints 64

if (counter > 4) { System.out.print("End"); } : True

<em>This prints "End"</em>

So; the output of the program is:

2 4 8 16 32 64 End

You might be interested in
________ are used in input, processing, and output operations that can help create more efficient programs as the data can be pr
lapo4ka [179]
Functional requirements <span>are used in input, processing, and output operations that can help create more efficient programs as the data can be processed many times without having to be input again.
</span>The functional requirements define function/s of a system or its component. It <span>describes what a software system should do.</span>
8 0
3 years ago
Um?<br><br> i went to check my questions and i found this-
asambeis [7]

Answer:

just go ahead and refresh the page

Explanation:

5 0
2 years ago
What is the recommended size for bulleted text? 12–22 24–40 44–66 54–80
algol [13]
44–66

According to sources, the most probable answer to this query is 44–66 point size.
This is because the eyes and the illustration should match the proportion of distance and height factors.
Thank you for your question. Please don't hesitate to ask in Brainly your queries. 
5 0
3 years ago
A ___________ allows Internet telephony service providers to deliver telephony services and unified communications applications
Firlakuza [10]

Answer: SIP Trunk

Explanation:

   The SIP is stand for the session initiation protocol trunk is one of the service that is specifically provided by the service provider and the main purpose of the SIP trucking is to manage the VoIP call process (Voice over IP).

According to the given question, SIP is one of the protocol that allow telephony services for the communication purpose and it also offer the video, Message, media and the voice application and these process are control by using this type of technology.  

 Therefore, SIP Truck is the correct answer.  

8 0
3 years ago
Which tab on the ribbon houses the sort functions?<br><br> Insert<br> Data<br> View<br> Home
irinina [24]

Answer:

data

Explanation:

got it right on edgenuity

6 0
3 years ago
Other questions:
  • If you have a 3D printer please show me a vid of you making something because I'm interested in getting one. Ty! Also can someon
    12·1 answer
  • Which of the following best explains why some people invest their saving in the stock market and others put their saving in bank
    5·2 answers
  • An investigator obtains consent and HIPAA authorization from subjects to review their medical records and HIV status. He plans t
    8·1 answer
  • Which resources could be used a lot when installing a desktop app for synchronization purposes? Choose two answers.
    5·1 answer
  • Differences between Quality of Services and a Service of Quality approach
    9·1 answer
  • Return the "centered" average of an array of ints, which we'll say is the mean average of the values, except ignoring the larges
    6·1 answer
  • which one of the following word process feature saves you the most time when you keying in a document
    9·1 answer
  • If you wanted to make the system sequentially consistent, what are the key constrains you need to impose
    6·1 answer
  • State three advantages of using a printer​
    15·1 answer
  • Why does computer uses 0s and 1s to procress data​
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!