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]
4 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]4 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
What is the signifigance of the following sentence in relation to font?
Sladkaya [172]
A it has every letter if the alphabet because if you go one by one on the alphabet every letter is in it
7 0
3 years ago
Fifteen years ago, everyone didn't have a cell phone. Anyone developing an app would not have found many users. Today, the exist
yarga [219]

Answer:

Are there any options?

Explanation:

The world is frequently coming in with better and more advanced technologies. More people are entering the digital world every day. The pace at which disruptive technologies are arriving is accelerating – and they’re changing how we live. The same technologies are giving rise to new business models. Example of development in the past 15 years- A.I.

6 0
2 years ago
Laura is the first person in her SDLC team to detect and predict security vulnerabilities in the software. In which phase is Lau
Eddi Din [679]

Answer:

answer is c

if my answer is wrong than sorry

7 0
3 years ago
Emily is working in a retail store. she is vulnerable to
Bumek [7]
Physical injuries caused by lifting heavy loads.
6 0
3 years ago
Read 2 more answers
You wrote a list of steps the user will take to perform a task. You have created a
marusya05 [52]

Answer:

You created an algorithm

Explanation:

The question would be better answered if there are options. Since there is none, I'll answer on a general term.

One answer that fits the description in the question is an algorithm. When you write an algorithm, you have written a guide or a step to achieve/complete a task.

Take for instance, you wrote step by step on how to use a microwave or for a user to operate a computer or for whatever instruction it might be; what you have done is that you have written an algorithm.

This is then further divided into two;

The instructions could be in form of (1) a flowchart or (2) a pseudocode

Irrespective of (1) & (2), what you've created is an algorithm.

4 0
3 years ago
Other questions:
  • WILL GIVE BRAINLIEST PLEASE HELP / urgent
    9·1 answer
  • WILL GIVE BRAINLIEST!!!!!!!!
    6·1 answer
  • The entirety of a packet at one layer becoming the payload section at another layer is known as
    8·2 answers
  • Which of the following is NOT true about adjustment layers? brainbuffet
    7·1 answer
  • Which of the following extends a network over a large geographic area by connecting local area networks together?
    14·2 answers
  • How does the post process alert the user if it detects a hardware problem during the post process?
    6·1 answer
  • Adam, a flower shop owner, wants to drive phone calls to his store. Which Adwords tool should he use to track how many calls res
    15·1 answer
  • 1. Flash Drive Price - An electronics company makes 64 gigabyte USB flash drives that cost them $8.00 apiece to produce. Write a
    9·1 answer
  • You are building a game that needs to do the following:
    5·1 answer
  • Please help me to creat flow chart tq​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!