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
kotegsom [21]
3 years ago
8

Write a recursive function num_eights that takes a positive integer pos and returns the number of times the digit 8 appears in p

os
Computers and Technology
1 answer:
nata0808 [166]3 years ago
7 0

Answer:

Explanation:

The following is written in Java. It creates the function num_eights and uses recursion to check how many times the digit 8 appears in the number passed as an argument. A test case has been created in the main method and the output can be seen in the image below highlighted in red.

  public static int num_eights(int pos){

       if (pos == 0)

           return 0;

       if (pos % 10 == 8)

           return 1 + num_eights(pos / 10);

       else

           return num_eights(pos / 10);

   }

You might be interested in
What command can be used to export an nps backup file named npsconfig.xml that can be used to restore nps configuration on anoth
irakobra [83]

The command is Export-NpsConfiguration    

An admin can export the entire NPS configuration from one NPS for import to another NPS. Standard precautions should be taken when exporting NPS configurations over the network. The command syntax that can be used for exporting the NPS configurations is Export-NpsConfiguration –Path <filename>


3 0
3 years ago
Which is the correct process for opening a blank spreadsheet?
Step2247 [10]
The best way of doing this would be when you are opening a document application, the first thing that you would do in this case in to click "new". And by clicking new, you would have a fresh new spread sheet.
5 0
3 years ago
What is the difference between (IF instructions &amp; WHILE instructions )<br> 0<br> 를 들<br> T<br> !
lara31 [8.8K]

Answer:

While statements determine whether a statement is true or false. If what’s stated is true, then the program runs the statement and returns to the first step. If what’s stated is false, the program exits the while and goes to the next statement. An added step to while statements is turning them into continuous loops. If you don’t change the value so that the condition is never false, the while statement becomes an infinite loop.

If statements are the simplest form of conditional statements, statements that allow us to check conditions and change behavior/output accordingly. The part of the statement following the if is called the condition. If the condition is true, the instruction in the statement runs. If the condition is not true, it does not. The if statements are also compound statements. They have a header (if x) followed by an indented statement (an instruction to be followed is x is true). There is no limit to the number of these indented statements, but there must be at least one.

7 0
3 years ago
Choose the term that makes the sentence true.
Colt1911 [192]
The windows of death color is blue and with a sad face and says “your pc has ran to a problem and needs to restart. We’re just collecting some error info, and then we will restart it for you
8 0
3 years ago
During the _______ steps of the information processing cycle, data is manipulated, calculated, or organized to create useful inf
labwork [276]

Answer: processing

Explanation:

During the processing steps of the information processing cycle, data is manipulated, calculated, or organized to create useful information.

At this stage, the data that has been gotten will have to be worked on by manipulating it, making necessary calculations in order to get a useful information out of it.

6 0
3 years ago
Other questions:
  • What type of devices are the key board and the mouse?
    10·1 answer
  • What is the leading use of computers
    15·2 answers
  • "The effectiveness of memory retrieval is directly related to the similarity of cues present when the memory was encoded to the
    11·1 answer
  • What are the two most popular applications of theInternet?
    7·1 answer
  • Please create C program, the task is to implement a function edoublepowerx that has an input parameter x of floating-point value
    11·1 answer
  • Ryan is looking to buy a new HDTV set. He knows from friends that LCD set screens reflect less light than plasma set screens, bu
    10·1 answer
  • If, after fetching a value from memory, we discover that the system has returned only half of the bits that we expected; it is l
    8·1 answer
  • 9. Lael wants to determine several totals and averages for active students. In cell Q8, enter a formula using the COUNTIF functi
    9·1 answer
  • 2 red and 2 overlapping balls in the center are surrounded by a green, fuzzy, circular cloud with a white line running through i
    15·2 answers
  • To make changes to how UAC operates, you must be logged in as administrator true or false
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!