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
Write a Scientific report modeling a written reasearch paper on big data applications.​
Tom [10]

Answer:

hi im writing this to get points but i hope your doing good in school and pass you got this school is almost over good job bye

Explanation:

6 0
3 years ago
Inserting diagrams into documents can help readers better understand document text. True or False?
Masja [62]
It's true because you can get a better understanding when looking at the evidence.
4 0
3 years ago
Which string method returns true if the character is a lowercase letter?
Llana [10]
The right answer is : is.lower(letter)
8 0
3 years ago
These operating systems were referred to as command-based.
alexira [117]

Command-Line Interface (CLI)


3 0
3 years ago
Computer viruses often spread by means of what?
lozanna [386]
Email attachments hope this helps
8 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the following is NOT one of the responsibilities of the Federal Reserve?
    10·1 answer
  • Why do most programmers indent the conditionally executed statements in a decision structure?
    7·1 answer
  • Which of the following is an example of a wanted versus I need
    5·1 answer
  • The number of semi skilled workers in an industry find themselves out of work, when improvements in technology render their jobs
    15·1 answer
  • Match the file extensions to the file types. Some file types may be used more than once.
    11·1 answer
  • In which of the following careers are you most likely to do an apprenticeship?
    14·2 answers
  • In this lab, you will build a system for package delivery services that provides different shipping options with specific price.
    6·1 answer
  • What is an rgv in coding
    10·2 answers
  • If I bought mine craft p.e. for 7.99 and hook my Micro soft account up, will i get java edition
    11·1 answer
  • Which of the following shows how to correctly declare pointer variable x?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!