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

Write a function called arraySum() that takes two arguments: an integer array and the number of elements in the array. Have the

function return as its result the sum of the elements in the array
Engineering
1 answer:
Oduvanchick [21]3 years ago
5 0

Answer:

//Function is written using C++ Programming Language

// Comments are used for explanatory purpose

// The main method is not included

using namespace std;

// Declare arraySum with two arguments. The first represents the array name while the other

// Represents the number of elements

int arraySum(int arr[], int n)

{

int total = 0; // declare and Initialise total to 0

// Iterate through the array to calculate sum

for (int i = 0; i < n; i++) {

total += arr[i];

}

return total;

}

You might be interested in
Takt time is the rate at which a factory must produce to satisfy the customer's demand. a)- True b)- False
laila [671]

Answer: a)True

Explanation: Takt time is defined as the average time difference between  the production of the two consecutive unit of goods by the manufacturer and this rate is matched with the demand of the customer. This is the time which is calculated to find the acceptable time for which the goods unit must be produced  by the factory to meet the needs of the customer. Therefore , the statement is true that takt time is the rate at which a factory must produce to satisfy the customer's demand.

6 0
3 years ago
A segment of four-lane freeway (two lanes in each direction) has a 3% upgrade that is 1500 ft long followed by a 1000-ft 4% upgr
Dennis_Churaev [7]

Answer:

The level of service of of compound grade freeway is LOSB.

Explanation:

Find the provided attachments for explanation

3 0
3 years ago
(40 points) Program the following sorting algorithms: InsertionSort, MergeSort, and QuickSort. There are 9 test les uploaded for
babunello [35]

Answer:

Explanation:

MERGE SORT

#include<stdlib.h>

#include<stdio.h>

#include<string.h>

void merge(int arr[], int l, int m, int r)

{

int i, j, k;

int n1 = m - l + 1;

int n2 = r - m;

 

int L[n1], R[n2];

for (i = 0; i < n1; i++)

L[i] = arr[l + i];

for (j = 0; j < n2; j++)

R[j] = arr[m + 1+ j];

i = 0;

j = 0;

k = l;

while (i < n1 && j < n2)

{

if (L[i] <= R[j])

{

arr[k] = L[i];

i++;

}

else

{

arr[k] = R[j];

j++;

}

k++;

}

while (i < n1)

{

arr[k] = L[i];

i++;

k++;

}

while (j < n2)

{

arr[k] = R[j];

j++;

k++;

}

}

void mergeSort(int arr[], int l, int r)

{

if (l < r)

{

int m = l+(r-l)/2;

mergeSort(arr, l, m);

mergeSort(arr, m+1, r);

merge(arr, l, m, r);

}

}

void printArray(int A[], int size)

{

int i;

for (i=0; i < size; i++)

printf("%d ", A[i]);

printf("\n");

}

int main()

{

int arr[1000] = {0};

int arr_size =0;

int data;

char file1[20];

strcpy(file1,"data.txt");

FILE *fp;

fp = fopen(file1,"r+");

if (fp == NULL) // if file not opened return error

{

perror("Unable to open file");

return -1;

}

else

{

fscanf (fp, "%d", &data);    

arr[arr_size]=data;

arr_size++;

while (!feof (fp))

{  

fscanf (fp, "%d", &data);  

arr[arr_size]=data;

arr_size++;    

}

}

printf("Given array is \n");

printArray(arr, arr_size);

mergeSort(arr, 0, arr_size - 1);

printf("\nSorted array Using MERGE SORT is \n");

printArray(arr, arr_size);

return 0;

}

3 0
3 years ago
A 6-pack of canned drinks is to be cooled from 23°C to 3°C. The mass of each canned drink is 0.355 kg. The drinks can be treated
Vesna [10]

Answer:

178 kJ

Explanation:

Assuming no heat transfer out of the cooling device, and if we can neglect the energy stored in the aluminum can, the energy transferred by the canned drinks, would be equal to the change in the internal energy of the canned drinks, as follows:

ΔU = -Q = -c*m*ΔT (1)

where c= specific heat of water = 4180 J/kg*ºC

           m= total mass = 6*0.355 Kg = 2.13 kg

           ΔT = difference between final and initial temperatures = 20ºC

Replacing by these values in (1), we can solve for Q as follows:

Q = 4180 J/kg*ºC * 2.13 kg * -20 ºC = -178 kJ

So, the amount of heat transfer from the six canned drinks is 178 kJ.

8 0
3 years ago
Read 2 more answers
A vertical curve is designed for 55 mi h and has an intial grade of +2.5
Dafna1 [17]

Vertical curves are the curves which provide a vehicle to negotiate elevation rate change at a slow rate.

<u>Explanation:</u>

A vertical curve gives a progress between two slanted roadways, permitting a vehicle to arrange the height rate change at a slow rate as opposed to a sharp cut.

In any event four distinct criteria for building up lengths of list vertical bends are perceived somewhat. These are (1) front light sight separation, (2) rider comfort, (3) waste control, and (4) a dependable guideline for outward presentation.

8 0
3 years ago
Other questions:
  • A forklift raises a 90.5 kg crate 1.80 m. (a) Showing all your work and using unity conversion ratios, calculate the work done b
    14·2 answers
  • For the pipe-fl ow-reducing section of Fig. P3.54, D 1 5 8 cm, D 2 5 5 cm, and p 2 5 1 atm. All fl uids are at 20 8 C. If V 1 5
    10·1 answer
  • This search compares the target value with the middle element in the collection, then ignores the half of the collection in whic
    11·1 answer
  • Steam enters a turbine at 120 bar, 508oC. At the exit, the pressure and quality are 50 kPa and 0.912, respectively. Determine th
    5·1 answer
  • What is the horizontal distance from Point A to toe of slope?
    12·1 answer
  • Two loads connected in parallel draw a total of 2.4 kW at 0.8 pf lagging from a 120-V rms, 60-Hz line. One load absorbs 1.5 kW a
    5·1 answer
  • Water flows around a 6-ft diameter bridge pier with a velocity of 12 ft/s. Estimate the force (per unit length) that the water e
    8·1 answer
  • Technician A says that the most commonly used combustion chamber types include hemispherical, and wedge. Technician B says that
    9·1 answer
  • Jack has been concerned about the rapidly changing green regulations in his state and his ability as a mechanical engineer to ke
    13·1 answer
  • Chemical engineers determine how to transport chemicals.<br> O True<br> False
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!