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
Supply is a powerful force in a free market.
Greeley [361]

Answer:

Input prices, number of sellers, technology, natural and social factors, and expectations.

Explanation:

Input in prices: When the prices go up supply will fall because lower quantities will be demanded.

Number of sellers: When the number of sellers are more, it will affect sales which is supply.

Technology: This helps in making supply to be properly done. Latest technology such as waybill, email, uber drivers, dispatch via logistics companies, shipment, air cargo carriers and a lot more.

5 0
4 years ago
Read 2 more answers
State the name of the following computer components​
olga2289 [7]

Answer:

Memory.

Hard Drive or Solid State Drive.

Video card.

Motherboard.

Processor.

Power Supply.

Monitor.

Keyboard and Mouse.

Explanation:

6 0
2 years ago
Read 2 more answers
Python Coding:
leva [86]

Answer:

# Here we are asking the user for a number two times

userInput1 = input("Enter any #: ")

userInput2 = input("Enter any # again: ")

# We compare if userInput1 is greater than userInput2

if(userInput1 > userInput2):

   # Print userInput1 if userInput1 is greather than userInput2

   print("First Number: " + userInput1)

   # Otherwise, print userInput2

else:

   print("Second Number: " + userInput2)

# Initiate a while-loop

while(True):

   # The lines below are from above

   userInput1 = input("\nEnter any #: ")

   userInput2 = input("Enter any # again: ")    

   if(userInput1 > userInput2):

       print("First Number: " + userInput1)

   else:

       print("Second Number: " + userInput2)

   # We ask the user whether they would like to stop

   stop = input("\nWould you like to stop? (Yes or No)")

   # Compare the String stop with "Yes"

   if(stop == "Yes"):

       # If true then break

       break

Explanation:

The use of \n is unnecesary, but it skips a line and provides more readability.

5 0
2 years ago
Help With Sims 4
Norma-Jean [14]

You should probably try removing it one by one if you dont want to get rid of all of it. it might take some time but,,,,

4 0
3 years ago
In a paragraph, describe in detail a practical real-world example of where you would implement a singly-linked list and why a si
frosja888 [35]

Answer:

travel

Explanation:

One real world example of a singly-linked list would be travel. Imagine that you want to take a trip to your nearest neighbor state. To do so you would need to take a 2 buses and a train, but you can't just take any or in any order you wish. You first need to take the first bus at your current location, get off at the train station, take that train to the final stop, get off and take the bus to the final destination. Meaning there is a sequence of connected events that you must follow in order to get to your destination and the same opposite sequence of events to get back. This is exactly like a singly-linked list.

3 0
3 years ago
Other questions:
  • Which signal types are represented by a continuous wave form?
    11·1 answer
  • A dog walks 10 km north in 2 hours and then 8 km south in 1 hour.
    10·1 answer
  • Original list:0,0,0,0,0,0,0,0
    10·1 answer
  • What directs the read/write arm of the hard drive to where data exists and accesses it upon the user's request?
    8·1 answer
  • Impact of computer in society, using relevant examples​
    13·1 answer
  • What do u think a creative app must have? <br><br> Please answer the question ASAP!!
    5·1 answer
  • 10. Realice un algoritmo que solicite números y los sume, solo se detendrá cuando se ingrese un número negativo.
    10·1 answer
  • What are the best legendary pokemon?
    15·2 answers
  • What should the Dhruv consider when connecting to the Internet in a public place? Select all that apply.
    11·1 answer
  • if we try to use tail-recursive rules to implement non-tail-recursive rules, it will normally result in rules that are
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!