Program that sums a sequence of integers

Assignment Help Business Management
Reference no: EM131441456

Write a program that sums a sequence of integers. Assume that the first integer read with scanf () specifies the number of values remaining to be entered. Your program should read only one value each time scanf() is executed.

A typical input sequence might be 5 100 200 300 400 500

Use the below program template to answer each question. The program is created by answering all the questions hence, do not skip any question.

Programming Shell Template

Instructions

  1. Using the Xendesktop, open Visual Studio 2015. Create a new project and add a new .cpp file to the project.  Type the programming shell template as stated up above and continue with the following steps below.  Be sure to include comments throughout your program for readability purposes.
  2. (Housekeeping): Declare the following variables in your program using appropriate data type. When selecting a data type keep in mind the type of value you want to store, i.e., int, float, character.  Also, be sure to use conventional naming standards for all variable declarations.
    • number
    • sum

       (Hint): Since sum is going to be used for adding the value, it needs to be initialized to zero.

(Display Prompt): Write a printf() statement to ask user for the following message.

  1. (Input):Add a scanf() statement to store user input for the number of values they wish to process.
  2. (Loop structure):Now, you will write a loop structure to iterate for the number of values you want user to input.

To begin with, your loop structure will look like this - 

  1. Declare the following variable inside the loop to store the current value. Remember, the scope of this variable is limited to the loop only. It can't be referred or used outside the loop.
    • value
  2. (Output):Inside the loop, write a display prompt using a printf() statement for user to input a value using the following message.
  3. (Input):Write a scanf() statement to store the value the user keys in from the keyboard into the variable named value. 
  4. (Assignment Statement):Here comes the main part of your program. Now, you need to add this value into the variable sum. So write an assignment statement to add the input value.
  5. (Output):Outside of the loop, write a printf() statement to display the value of sum. Remember, the variable sum is declared outside of the loop so it can be referred/used anywhere within the main function. Also, to display the value stored in a variable you need to include a conversion specifier inside of the quotation marks in the printf() and the variable names within the parentheses.

Reference no: EM131441456

Questions Cloud

Current healthcare system in the united states : For this final assignment, imagine that you had the ability to change anything you wanted with regards to the current healthcare system in the United States. In a one to two page paper, outline the changes you would make to increase access, increa..
Scale organic farms fit with their broader social ideology : In the last few years is Whole Foods more about growth or its social mission? How does their support of practices such as the development of large scale organic farms fit with their broader social ideology?
Explain topic - transformer and their ratio : Write about a given topic. Topic - Transformer and their ratio. Very well presented and brief description about the topic
What value is provided by using an engineering approach : Why should an organization consider utilizing a systems analysis and design methodology when building a new system instead of building a system in any which way that seems to be fast and simple? What value is provided by using an engineering approach..
Program that sums a sequence of integers : Write a program that sums a sequence of integers. Assume that the first integer read with scanf () specifies the number of values remaining to be entered. Your program should read only one value each time scanf() is executed.
Consider three finalists for a new position : The executives of GDD are meeting to consider three finalists for a new position: Division Head of the Middle East. The winning candidate will be in a high- profile job. The effectiveness of the person in this new lead position is of utmost importanc..
What is the standard deviation of the project npv : Consolidated Oilfield plc is interested in exploring for oil near the west coast of Australia. The Australian government is prepared to grant an exploration license to the company for a five-year period for a fee of £250,000 per annum.
Write about green chemistry : Topic - Green Chemistry. A PowerPoint presentation Very well presented giving all necessary information about the topic
Linear relationships between body measurements : In this section, we saw a relationship between armspans and height. There are other linear relationships between body measurements. One such relationship is between the circumference of a wrist and the circumference of a neck.

Reviews

Write a Review

Business Management Questions & Answers

  Caselet on michael porter’s value chain management

The assignment in management is a two part assignment dealing 1.Theory of function of management. 2. Operations and Controlling.

  Mountain man brewing company

Mountain Man Brewing, a family owned business where Chris Prangel, the son of the president joins. Due to increase in the preference for light beer drinkers, Chris Prangel wants to introduce light beer version in Mountain Man. An analysis into the la..

  Mountain man brewing company

Mountain Man Brewing, a family owned business where Chris Prangel, the son of the president joins. An analysis into the launch of Mountain Man Light over the present Mountain Man Lager.

  Analysis of the case using the doing ethics technique

Analysis of the case using the Doing Ethics Technique (DET). Analysis of the ethical issue(s) from the perspective of an ICT professional, using the ACS Code of  Conduct and properly relating clauses from the ACS Code of Conduct to the ethical issue.

  Affiliations and partnerships

Affiliations and partnerships are frequently used to reach a larger local audience? Which options stand to avail for the Hotel manager and what problems do these pose.

  Innovation-friendly regulations

What influence (if any) can organizations exercise to encourage ‘innovation-friendly' regulations?

  Effect of regional and corporate cultural issues

Present your findings as a group powerpoint with an audio file. In addition individually write up your own conclusions as to the effects of regional cultural issues on the corporate organisational culture of this multinational company as it conducts ..

  Structure of business plan

This assignment shows a structure of business plan. The task is to write a business plane about a Diet Shop.

  Identify the purposes of different types of organisations

Identify the purposes of different types of organisations.

  Entrepreneur case study for analysis

Entrepreneur Case Study for Analysis. Analyze Robin Wolaner's suitability to be an entrepreneur

  Forecasting and business analysis

This problem requires you to apply your cross-sectional analysis skills to a real cross-sectional data set with the goal of answering a specific research question.

  Educational instructional leadership

Prepare a major handout on the key principles of instructional leadership

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