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
sdas [7]
3 years ago
14

The divBySum method is intended to return the sum ofall the elements in the int arrayparameter arr that are divisible by the int

parameter num. Consider the following examples, in whichthe array arrcontains {4, 1, 3, 6, 2, 9}.The call divBySum(arr, 3) will return 18,which is the sum of 3, 6, and 9,since those are the only integers in arr that aredivisible by 3.The call divBySum(arr, 5) will return 0,since none of the integers in arr are divisibleby 5.Complete the divBySum method using anenhanced for loop. Assume that arr isproperly declared and initialized. The method must use anenhanced for loop to earn full credit./** Returns the sum of all integers inarr that are divisible by num* Precondition: num > 0*/public static int divBySum(int[] arr, int num)
Computers and Technology
1 answer:
charle [14.2K]3 years ago
4 0

Answer:

Explanation:

The following program is written in Java and creates the divBySum method using a enhanced for loop. In the picture attached below I have provided an example of the output given if called using the array provided in the question and a divisible parameter of 3.

public static int divBySum(int[] arr, int num) {

       int sum = 0;

       for (int x : arr) {

           if ((x % num) == 0) {

               sum += x;

           }

       }  

       return sum;

   }

You might be interested in
Can someone who is good at 9th class IT (cbsce) can help me in my homework​
postnew [5]

Answer: yeah

Explanation:

4 0
3 years ago
How is digital footprint created ?
dalvyx [7]

Answer:

by simply just logging on and using the internet.

Explanation:

4 0
3 years ago
Explain about third generation of computer​
diamong [38]

Answer:

The period of third generation was from 1965-1971. The computers of third generation used Integrated Circuits (ICs) in place of transistors. ... This development made computers smaller in size, reliable, and efficient. In this generation remote processing, time-sharing, multiprogramming operating system were used.

Explanation:

hope it helps

6 0
3 years ago
In a paragraph of no less than 125 words, explain what netiquette is and how it improves efficiency and productivity in the work
Ierofanga [76]

In very simple terms, netiquette is etiquette on the internet. It is a short form of network etiquette. It represents the importance of proper manners online. Common guidelines for good netiquette include being very courteous and avoiding instances of cyber-bullying. Although the specific protocols governing netiquette may differ depending on the forum being used, it is equally applicable to emails and surfing the internet, message boards, and chatting. In the workplace, netiquette implies that you have polite manners, and that you would want to build up relationships with people. By showing respect to your colleague through proper netiquette, it will show how productive you can be and as result, you will earn respect. Understanding netiquette in the workplace can save you from embarrassing moments. In sending job emails, for instance, always speak clearly and avoid using capitalized words, spelling errors, or slang.

8 0
4 years ago
The two roots of a quadratic equation, for example 2 + + = 0, can be obtained using the following formula: Two Roots: 1 = − + √
Vladimir79 [104]

lst = input("Enter a,b,c: ").split(",")

a = float(lst[0])

b = float(lst[1])

c = float(lst[2])

root1 = (-b + ((b**2-(4*a*c))**0.5))/(2*a)

root2 = (-b - ((b**2-(4*a*c))**0.5))/(2*a)

dis = b**2 - (4*a*c)

if dis > 0:

   print("The roots are {} and {}".format(root1, root2))

elif dis < 0:

   print("The equation has no real roots")

else:

   print("The root is {}".format(root1))

I wrote my code in python 3.8. I hope this helps!

5 0
3 years ago
Other questions:
  • PL Technologies suffered considerable data loss when its database was infected by a virus. George, an operations personnel, atte
    8·1 answer
  • Is a software program that allows users to access the world wide web
    10·1 answer
  • What output will the look up formula below produce in relation to the following table?
    11·1 answer
  • What is the printout for the first statement in the main method?
    13·1 answer
  • 1 Which of these is not an Operating System ?
    7·2 answers
  • Judy forgot where she saved a certain file on her computer. Therefore, she searches for all files with a .jpg file extension. Wh
    7·2 answers
  • Identify a true statement about heuristics: a. They are more complicated than algorithms. b. Unlike algorithms, they do not perm
    15·1 answer
  • Before you ever buy your first stock or bond, it's important to understand what type of investor you are. This depends on a numb
    12·1 answer
  • Do you think the current video game industry is likely to experience another “crash” (similar to the one in the 1980s) any time
    10·1 answer
  • Moving images of real event​
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!