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
Gnesinka [82]
3 years ago
12

Write the definition of a method named sumArray that has one parameter, an array of ints. The method returns the sum of the elem

ents of the array as an int.
Computers and Technology
1 answer:
White raven [17]3 years ago
8 0

Answer:  Following code is in C++

#include<iostream>

using namespace std;

int sumArray(int a[])  //take array as argument

{

   int s=0,i;

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

       s+=a[i];  //sums every element

   return s;

}

int main() {

   int sum,a[]={1,7,4,9,6};

   sum=sumArray(a);   //calling the function

   cout<<"Sum of array is : "<<sum;   //printing sum to console

return 0;

}

OUTPUT :

Sum of array is : 27

Explanation:

In the above mentioned code, an array is declared and initialized at the same time. A variable sum of int type stores sum returned the function sumArray() and then it is printed to the console. In the function sumArray(), a variable s of data type int is initialized with value 0 and a loop is executed in which every element of the array is added. At last, s is returned.

You might be interested in
Please help ASAP!
makkiz [27]
B. training is the correct answer
8 0
2 years ago
Match each definition to the correct type of media.
Murrr4er [49]

Answer:

1-2

2-3

3-1

Explanation:

I couldn't find a way to explain this.

6 0
3 years ago
Read 2 more answers
An advertisement for new headphones lists the cool colors available, the great sound quality, and the fabulous reviews but fails
Mama L [17]

d transfer

ive seen the ad

7 0
3 years ago
8.3 code practice edhesive PLEASE HELP AND HURRY
NemiM [27]

Answer:

numbers = '14 36 31 -2 11 -6'

nums = numbers.split(' ')

for i in range(0, len(nums)):

  nums[i] = int(nums[i])

print(nums)

8 0
3 years ago
What is the difference between the (BIOS) basic.input.output.system and R.O.M
abruzzese [7]
EX: A BIOS is a file used to make an emulator work properly. <span>A ROM is a copy of a game downloadable online.</span>
6 0
3 years ago
Other questions:
  • According to the video, what education and experience do employers look for in Reporters and Correspondents? Check all that appl
    10·2 answers
  • Ssume the following variables contain the values shown: numberRed = 100 numberBlue = 200 numberGreen = 300 wordRed = "Wagon" wor
    5·1 answer
  • After modifying the font of the Subheading1 style, you notice that the font of Subheading2 has also changed. What is the most li
    12·2 answers
  • A palindrome is a word or phrase that reads the same both backward and forward. The word ""racecar"" is an example. Create an al
    15·1 answer
  • A(n) ________ moves over the spinning platters to retrieve data from the hard disk.
    6·1 answer
  • Alison is having a hard time at work because her Inbox is flooded with emails every day. Some of these emails are unsolicited. S
    15·2 answers
  • 7.) Title text boxes on every slide must be the same format. <br> A. True <br> B. False
    15·2 answers
  • Why is drive of value when pursuing a career in IT?
    14·1 answer
  • Primary memory consists of the various devices that are able to store data and programs even when the power is off. true or fals
    11·1 answer
  • Why is it important to continiously conduct penetration testing for a strong security system?.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!