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
The process of encoding messages or information in such a way that only authorized parties can read it is called ____________.
lukranit [14]

Answer:

Encryption

Explanation:

Encryption is a term in the field of computer security (Cryptology) this is a process of encoding information in a way that hackers and eavesdroppers cannot read. The process of encryption involves a plain text (message) been converted into a scrambled text (cipher text) with an encryption algorithm (key) in this way, if the message is intercepted by a hacker he/she is unable to read the contents. Only the authorized party with a decryption key will be able to decrypt back to a plain text and read the contents of the message

3 0
2 years ago
Description:
Nastasia [14]

Answer:

The programming language is not stated (I'll answer using C++)

#include <iostream>

using namespace std;

int convert(float miles)

{

   return miles * 5280;

}

int main() {

   cout<<"Console:"<<endl;

   cout<<"Hike Calculator"<<endl;

   float miles;

   char response;

   cout<<"How many miles did you walk?. ";

   cin>>miles;

   cout<<"You walked "<<convert(miles)<<" feet"<<endl;

   cout<<"Continue? (y/n): ";

   cin>>response;

   while(response == 'y')

   {

   cout<<"How many miles did you walk?. ";

   cin>>miles;

   cout<<"You walked "<<convert(miles)<<" feet"<<endl;

   cout<<"Continue? (y/n): ";

   cin>>response;

   }

   cout<<"Bye!";

   return 0;

}

Explanation:

Here, I'll explain some difficult lines (one after the other)

The italicized represents the function that returns the number of feet

<em>int convert(float miles) </em>

<em>{ </em>

<em>    return miles * 5280; </em>

<em>} </em>

The main method starts here

int main() {

The next two lines gives an info about the program

   cout<<"Console:"<<endl;

   cout<<"Hike Calculator"<<endl;

   float miles;

   char response;

This line prompts user for number of miles

   cout<<"How many miles did you walk?. ";

   cin>>miles;

This line calls the function that converts miles to feet and prints the feet equivalent of miles

   cout<<"You walked "<<convert(miles)<<" feet"<<endl;

This line prompts user for another conversion

   cout<<"Continue? (y/n): ";

   cin>>response;

This is an iteration that repeats its execution as long as user continue input y as response

<em>    while(response == 'y') </em>

<em>    { </em>

<em>    cout<<"How many miles did you walk?. "; </em>

<em>    cin>>miles; </em>

<em>    cout<<"You walked "<<convert(miles)<<" feet"<<endl; </em>

<em>    cout<<"Continue? (y/n): "; </em>

<em>    cin>>response; </em>

<em>    } </em>

   cout<<"Bye!";

8 0
3 years ago
460N of force is exerted on an object with a surface area of 2,5m.How much pressure is felt by the object?​
BartSMP [9]

Explanation:

p=F/A

p=460N/2m×5m

=46N/m2

7 0
2 years ago
Read 2 more answers
What term describes data actions being performed by endpoint devices, such as printing a report from a desktop computer?
Sloan [31]

Answer:

The correct answer to the following question will be "Data-in-use".

Explanation:

  • Data-in-use is an IT term referring to active information that is usually preserved in a semi-persistent physical state in RAM of computer, CPU registers or caches.
  • It might be created, modified or changed, deleted or accessed via different endpoints of the interface. This is indeed a useful term for IT departments to pursue institutional defense.

Therefore, it's the right answer.

4 0
2 years ago
How much does 1 American tank cost on gas for a regular mission? Depending on your answer, I will give you the right amount of p
dem82 [27]
Most of the cars or other vehicles in the United States regularly have tanks that can hold up to 12 gallons worth of gas. The price of gas in not consistent. Sometimes prices are high and sometimes prices are low. Just like to day the price of a gallon is worth $2.2. But in an average, gas costs $3.8 per gallons. Therefore, on a regular basis a standard American which can hold 12 gallons costs $46.2.
5 0
3 years ago
Other questions:
  • You are configuring two switches of different vendors such that they connect to each other via a single link that will carry mul
    13·1 answer
  • To enter a typed number into a cell, you press Tab or Backspace?​
    7·2 answers
  • In the single-site processing, single-site data (SPSD) scenario, all processing must be done on the end user's side of the syste
    10·2 answers
  • Write an application that instantiates five Recording objects and prompts the user for values for the data fields. Then prompt t
    13·1 answer
  • A(n) ____ instruction might look like a meaningless string of 0s and 1s, but it actually represents specific operations and stor
    9·1 answer
  • Which party controlled the White House and politics in the late 1800s, except for Grover
    6·2 answers
  • A write once, read many (worm) disc is a common type of _____.
    6·1 answer
  • Describe the major elements and issues with system prototyping​
    7·1 answer
  • Write a Python program (rainfall.py) to collect data and calculate the average rainfall over a period of years. The program shou
    11·1 answer
  • Why Use LinkedIn AI Automation Tools to Grow Your Sales Pipeline?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!