Calculate the sum of numbers. Use bellowed rules on your code, Input how many...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Calculate the sum of numbers. Use bellowed rules on your code, • • Input how many numbers use on summation. Input number and check the number is negative or positive. If number is positive, add to the sum If number is negative, call function negativeNumber. Add return of function to the sum. If number is 0 (zero), do not add to the sum. Display the sum. o negativeNumber function return its argument's square added to argument. x negativeNumber Check sample runs of this question. x+x IMPORTANT: Your code must produce the same interface as below sample runs by implementing a correct algorithm! Sample Runs: Enter how many numbers use on summation: 2 Enter an Integer number: -9 Enter an integer number: -5 Sun-92 Enter how many numbers use on summation: 3 Enter an integer number: 8 Enter an integer number: -5 Enter an integer number: 2 Sum-30 Enter how many numbers use on summation: 5 Enter an integer number: 7 Enter an integer number: 6 Enter an integer number: 2 Enter an integer number: 0 Enter an integer number: 4 Sun-19 Enter how many numbers use on summation: 6 Enter an integer number: -8 Enter an integer number: -1 Enter an integer number: 2 Enter an integer number: 4 Enter an integer number: 0 Enter an integer number: 6 Sum-68 Enter how many numbers use on summation: 7 Enter an integer number: -6 Enter an integer number: 5 Enter an integer number: 9 Enter an integer number: -2 Enter an Integer number: 0 Enter an integer number: 4 Enter an integer number: 3 Sum -53 Calculate the sum of numbers. Use bellowed rules on your code, • • Input how many numbers use on summation. Input number and check the number is negative or positive. If number is positive, add to the sum If number is negative, call function negativeNumber. Add return of function to the sum. If number is 0 (zero), do not add to the sum. Display the sum. o negativeNumber function return its argument's square added to argument. x negativeNumber Check sample runs of this question. x+x IMPORTANT: Your code must produce the same interface as below sample runs by implementing a correct algorithm! Sample Runs: Enter how many numbers use on summation: 2 Enter an Integer number: -9 Enter an integer number: -5 Sun-92 Enter how many numbers use on summation: 3 Enter an integer number: 8 Enter an integer number: -5 Enter an integer number: 2 Sum-30 Enter how many numbers use on summation: 5 Enter an integer number: 7 Enter an integer number: 6 Enter an integer number: 2 Enter an integer number: 0 Enter an integer number: 4 Sun-19 Enter how many numbers use on summation: 6 Enter an integer number: -8 Enter an integer number: -1 Enter an integer number: 2 Enter an integer number: 4 Enter an integer number: 0 Enter an integer number: 6 Sum-68 Enter how many numbers use on summation: 7 Enter an integer number: -6 Enter an integer number: 5 Enter an integer number: 9 Enter an integer number: -2 Enter an Integer number: 0 Enter an integer number: 4 Enter an integer number: 3 Sum -53
Expert Answer:
Answer rating: 100% (QA)
Solution Code in C to get the sample runs include Function to handle negative numbers int negativeNumberint n return n n n int main int count number s... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
) Consider integer division of one two's-complement binary number by another. Programming languages may vary in the result when one argument is negative. What differing conventions might they be...
-
Read the Comp & Ben Case Study and answer the following question: To the degree job growth (and increased car sales that come from m costs) is based on two tier-wage structures, how sustainable...
-
Once almost a rite of childhood, tonsillectomy (surgical removal of the tonsils) is now rarely performed. Similarly, while ruptured spleens were once routinely removed, they are now conserved...
-
Bill has just returned from a duck hunting trip. He has brought home eight ducks. Bills friend, John, disapproves of duck hunting, and to discourage Bill from further hunting, John has presented him...
-
James was driving a vehicle manufactured by a major automobile manufacturer. Accompanying him were his wife and two children. James accidently drove over a curb and crashed into the concrete base of...
-
You are in charge of inventory control of a highly successful product retailed by your firm. Weekly demand for this item varies, with an average of 200 units and a standard deviation of 16 units. It...
-
We have defined a PyTorch network class DAN for you. You need to implement the forward pass for your deep averaging network. To start, first implement average that averages the words in a review and...
-
Which statement is true when customers pay bills with a credit card? Question 1 options: a) You can use QuickBooks' Merchant Account Service to get online authorization and then download payments...
-
1. [CLO1] For the circuit shown in Figure 1. (a) Determine the current i(t) through the 42 resistor. [6] [2] (b) Comupte the average power delivered to each of the passive elements. (c) Verify your...
-
If you had computed the value of the linear correlation coefficient to be 3.335, what should you conclude?
-
What are the five components of the COSO IC-IF Model?
-
The perceptual process consists of six phases: Receiving, selecting, organizing, interpreting, checking, reacting Receiving, organizing, interpreting, selecting, checking, reacting Receiving,...
-
Use operational events as examples to show how internal auditors can use the 7Es to assess and improve operational success.
-
Asystem for registering genealogical trees allows different users to check if they have coincident people in their own trees. If this is the case, the shared person is marked in each tree as...
-
At a curtained point in a strained material the intensities of stress on two planes at right angle to each (30 + 30) N/mm 2 and 10N/mm 2 . They are accompanied by a shear stress of magnitude 10N/mm 2...
-
Why is inventory management important for merchandising and manufacturing firms and what are the main tradeoffs for firms in managing their inventory?
-
Tom has a successful business with $100,000 of income in 2012. He purchases one new asset in 2012, a new machine which is 7-year MACRS property and costs $25,000. If you are Tom's tax advisor, how...
-
Diego, age 28, married Dolores, age 27, in 2012. Their salaries for the year amounted to $46,479 and they had interest income of $3,500. Diego and Dolores' deductions for adjusted gross income...
-
Calculate the amount of the child and dependent care credit allowed for 2012 in each of the following cases, assuming the taxpayers had no income other than the stated amounts. a. William and Carla...
-
Figure 7.26 shows a cart striking a spring. In Figure 7.26a, consider the motion of the cart along the direct path from the initial position \(x_{1}\), which is the position at which the cart makes...
-
Standing a few meters from a skateboard, a boarder begins running and then jumps onto the board. Make bar diagrams like the ones in Figure 7.32 to illustrate the energy conversions \((a)\) while he...
-
Two carts are about to collide head-on on a track. The inertia of cart 1 is greater than the inertia of cart 2, and the collision is elastic. The speed of cart 1 before the collision is higher than...
Study smarter with the SolutionInn App