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]
2 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]2 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
Which of the following is an example of batch processing?
9966 [12]

Answer:

several personnel accessing the registration system

Explanation:

batch processing is all about multiprogramming so I think the first answer is the best as it is not based on one person .I know the last answer might be almost close but on a closer look it is not the answer as it is single based as written a file

7 0
3 years ago
Help plzzzz_________ provide a means of organizing and summarizing data A. Reports B. Metadata C. Connectors D. All
storchak [24]

Answer:

that is technical but I will go with all I mean d

8 0
3 years ago
Dave wants to host a website and he needs an operating system that is free of cost. Which operating system should he use? a MS D
Zigmanuir [339]
It is microsoft windows
8 0
3 years ago
Read 2 more answers
Write a program that reads an unspecified number of integers, determines how many positive and negative values have been read, a
Viktor [21]

Answer:

The program to this question can be given as:

Program:

import java.util.*;

//import package for user input  

class Main     //define class

{

public static void main(String a[])  

//define main function

{

int positive_number=0,negative_number=0,count=0,num; //define variable

double total=0,avg=0;  

//creating Scanner class object.

Scanner ob = new Scanner(System.in);

System.out.println("Enter an integer, when done input 0: "); //message

num= ob.nextInt();

//taking input from user

if (num==0)  //check number equal to 0  

{  

System.out.println("No numbers are entered except 0"); //message

System.exit(1);

}

else

{

while (num!= 0)  

{    

   if (num> 0)

   {

positive_number++; // Increase positives

}

else

{

negative_number++; // Increase negatives

}

total=total+num; // Accumulate total

count++;    // Increase the count

num=ob.nextInt();

}

// Calculate the average

avg=total/count;

// Display values

System.out.println("The positive number is:"+positive_number);

System.out.println("The negatives number is:"+negative_number);

System.out.println("total is:"+total);

System.out.println("average is:"+avg);

}

}

}

Output:

Enter an integer, when done input 0: 22

2

1

4

0

The positive number is:4

The negatives number is:0

total is:29.0

average is:7.25

Explanation:

In the above program firstly we import the package for user input then we define a class that is main in this class we define the main method in the main method we define variable. Then we create a scanner class object for user input. In the number variable, we take multiple inputs from the user and also check that the user does not insert 0 at the starting of the program. To check this we use the condition statement that is a number equal to 0 then it will terminate the program. In the else part we first declare the loop that checks that inserted number is positive and negative and in this, we calculate the total of the numbers and at the end of the loop, we calculate the average of the number and print all the values.

4 0
2 years ago
Read 2 more answers
1. Which of the following are examples of applied art? Select all that apply. (2 points)
Svetlanka [38]

Answers

1. Examples of applied in the list art are Architecture, Drawing and industrial design.

2. The following can be considered an artist’s media; substrate onto which art is created (ex: canvas, paper) and material with which to create art (ex: paint, clay)

Explanations

Applied art is the application of both artistic and design principles to practice and practical use. This type of art can be fine art and theoretical in practice. Examples of applied art are drawing and painting illustrations, woodblock prints, Print based art, industrial and interior design, architecture, car and toy design, landscaping, tattoos and pottery. An art media is the material used by an artist or designer to create a piece of work.





6 0
3 years ago
Read 2 more answers
Other questions:
  • What microsoft operating systems started the process of authenticating using password and username
    14·1 answer
  • A network administrator has been given a network of 172.16.85.0/21 and wants to know the usable range of IP addresses on that su
    13·1 answer
  • When viewing data entered into a spreadsheet, the columns identify _____.?
    5·1 answer
  • Given the following MIPS Code Fragment:
    14·1 answer
  • Is 5g harmful to the body ?
    9·2 answers
  • What type of device is characteristic of an enterprise environment?
    7·1 answer
  • What area displays the title of the document
    14·1 answer
  • What can be the maximum possible length of an identifier 3163 79 can be of any length​
    5·1 answer
  • What means the data is still saved even if you turn the computer off or unplug it?​
    5·1 answer
  • What is one of four key principles of Responsible Artificial Intelligence
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!