Array elements and returns the sum

Assignment Help Basic Computer Science
Reference no: EM132494177

Write the following functions. Each takes an array of ints and the array length. The return types differ. You should also create a temporary main() function for testing purposes. Use the array initialisation notation to create test arrays. (Later we'll replace this with another main() that takes user input via command-line parameters.)

(a) sum() - adds up all the array elements and returns the sum, an int. (For an array containing {5, 10, 15}, sum() should return 30.)

(b) max() - returns the index of the largest element in the array. (For an array containing {10, 5, 1}, max() should return 0. For the array {3, 15, 6, 500, 9} it should return 3).

(c) reverse() - reverses the order of the array elements. It doesn't return anything. (For an array containing {1, 2, 3, 4}, reverse() should change it to {4, 3, 2, 1}.)

Reference no: EM132494177

Questions Cloud

Option to implement it on windows server : An organization is in the process of migrating to a newer enterprise resource planning application. There is an option to implement it on Windows Server 2008
What amount can be awarded each year : What amount can be awarded each year, starting in a year, if the fund earns 7% compounded monthly? Travis makes a donation of $21000 to a local parks
What will the impact be on the business environment : Lower rates in response to the 2008 recession. What is the economic significance of this change? What will the impact be on the business environment?
Class deals with computer architecture : This class deals with computer architecture topics like logic circuits with gates and memory (byte-addressable and word-addressable).
Array elements and returns the sum : Write the following functions. Each takes an array of ints and the array length. The return types differ. You should also create a temporary
What was the value of the home theatre set at the time : The whole time interval (even when you don't have any payments). What was the value of the home theatre set at the time of purchase?
What is the maximum amount that can be withdrawn : The entire 25 year period is 4.3% compounded quarterly, then what is the maximum amount that can be withdrawn at the start of each quarter?
Chart for disasters caused by major forces of nature : The question wants me to comparison chart for disasters caused by major forces of nature (hurricane, tornado, earthquake, flood, and fire).
How much is jimmys rrsp worth : The beginning of every quarter for 35 years. Assume the interest rate is 7% compounded monthly. How much is Jimmy's RRSP worth after 35 years?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd