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
konstantin123 [22]
3 years ago
15

The sum of the elements of an integer-valued array recursively calculated as follows: The sum of an array of size 0 is 0; Otherw

ise, the sum is the value of the first element added to the sum of the rest of the array. Write an int-valued function named sum that accepts an integer array, and the number of elements in the array and returns the sum of the elements of the array.
Computers and Technology
1 answer:
Ugo [173]3 years ago
8 0
In what language? Most languages have iterator functions like map in JavaScript that will loop through the elements, making this almost a one liner

sum = 0
arr.map( elem => sum += elem )
You might be interested in
What to take for ptsd
REY [17]
Dank memes and medicine
6 0
4 years ago
Read 2 more answers
Given a Scanner reference variable named input that has been associated with an input source consisting of a sequence of strings
Ghella [55]

Answer:

count = 0;

longest =0;

String myString = new String();

while (input.hasNext()){

myString = input.next();

if (myString.length() == longest) count++;

else

if (myString.length() > longest){

longest = myString.length();

count = 1;

}

}

Explanation:

5 0
3 years ago
Read 2 more answers
In a C++ program, one and two are double variables and input values are 10.5 and 30.6. After the statement cin >> one >
SSSSS [86.1K]

Answer:

variable one stores 10.5 and two stores 30.6

Explanation:

In c++ language, the cout keyword is used to write to the standard output. The input from the user is taken by using the cin keyword.

For the input from the user, a variable need is declared first.

datatype variable_name;

The input can be taken one at a time as shown.

cin >> variable_name;

The input for more than one variable can be taken in a single line as given by the syntax below.

1. First, two variables are declared.

datatype variable_name1, variable_name2;

2. Both input is taken simultaneously as shown.

cin >> variable_name1, variable_name2;

For the given scenario, two double variables are declared as below.

double one, two;

The question mentions input values for the two double variables as 10.5 and 30.6.

3. The given scenario takes both the values as input at the same time, in a single line as shown below.

cin >> one >> two;

4. After this statement, both the values entered by the user are accepted.

The values should be separated by space.

First value is stored in the variable one.

Second value is stored in the variable two.

5. The user enters the values as follows.

10.5 30.6

6. The value 10.5 is stored in variable one.

7. The value 30.6 is stored in variable two.

The c++ program to implement the above is given below.

#include <iostream>

using namespace std;

int main() {

   double one, two;      

   cout << " Enter two decimal values " << endl;

   cin >> one >> two;

   cout << " The input values are " << endl;

   cout << " one : " << one << " \t " << " two : " << two << endl;

   return 0;

}

OUTPUT

Enter two decimal values  

10.5 30.6

The input values are  

one : 10    two : 530.6

6 0
3 years ago
If a class's only constructor requires an argument, you must provide an argument for every ____ of the class that you create.1.
Naddik [55]

Answer:

The answer is "Option 1"

Explanation:

In oops(object-oriented programming language) an object is an example of a specific class or subclass with methods or processes of the class itself and variables for data. When we create an object of the class the default constructor is automatically executed. and other options are not correct that an be described as follows:

  • In option 2, Type is used in data type. It is an attribute, that tells the user or programmer what kind of data value they store. for example string, numeric, and floating-point value.
  • In option 3, Parameter is used in the method for passing a value in function and calculate some values.
  • In option 4, A method is also known as a procedure, that associate with a message and an object.

8 0
3 years ago
Will a tablecloth that is 155 cm long cover a table that is 1.6 m long?
dimaraw [331]
Hello There!

This is just a conversion. 
155cm = 1.55m
Therefore, your answer is no it won't

Hope This Helps You!
Good Luck :) 

- Hannah ❤
3 0
4 years ago
Read 2 more answers
Other questions:
  • The ____ directory contains configuration files that the system uses when the computer starts.
    7·1 answer
  • What does ip mean? internet protocol address internet program internet process (system software) internet prescience?
    6·1 answer
  • why do programs include keyboard shortcuts for certain actions? do you prefer the mouse or the keyboard/ why?
    7·1 answer
  • 5255555555555+55555555555555/1111*99442
    14·2 answers
  • 1. If you are 15% years old, you are old enough to obtain
    10·2 answers
  • 1. [10 marks] We begin with some mathematics regarding uncountability. Let N = {0, 1, 2, 3, . . .} denote the set of natural num
    12·1 answer
  • 1) Type a statement that gets an input value into variable numBers. Assume scnr already exists and numBers has been declared.
    9·1 answer
  • Write a function, AvgList, that takes a single argument, a list, and returns the average (mean) of the numbers in the list. You
    10·1 answer
  • Cách soạn thảo văn bản trên word
    7·1 answer
  • What are the two protocols used most often with iot devices? (select two. )
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!