Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Sum of consecutive integers

A) Write a program that prompts for an integer-let's call it X-and then finds the sum of X consecutive integers starting at 1. That is, if X = 5, you will find the sum of1+2+3+4+5=15

B) Modifyyourprogrambyenclosingyourloopinanotherloopsothatyoucanfind consecutive sums. For example, if 5 is entered, you will find five sums of consecutive numbers:
1=1

1+2=3
1+2+3 = 6 1+2+3+4 = 10 1+2+3+4+5 = 15

Print only each sum, not the arithmetic expression.

C) Modify your program again to only print sums if the sum is divisible by the number of operands. For example, with the sum 1 + 2 + 3 + 4 + 5 = 15, there are five operands and the sum, 15, is divisible by 5, so that sum will be printed. (Do you notice a pattern?)

1=1
1+2+3=6

1+2+3+4+5=15

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M93125653

Have any Question?


Related Questions in Computer Engineering

Question summarize the human-computer interface hci of

Question : Summarize the human-computer interface (HCI) of Microsft Word 2013 and Microsoft Visio 2013. Explain the importance of HCI and usability of the software. Be sure to note any commonalities between the applicati ...

Question suppose host a has 10 packets with sequence

Question : Suppose host A has 10 packets with sequence numbers 1 to 10 to be transmitted to host B. Now imagine that the packets numbered 2 and 7 are lost when they were sent the first time. Assume that ACKs are never lo ...

Sorting algorithms are one kind of algorithm whose

Sorting algorithms are one kind of algorithm whose performance may depend upon the data. Choose one of the sorting algorithms or any other algorithm and explain whether the there are any differences in the best, average ...

Question 1conduct research to determine three types of

Question: 1. Conduct research to determine three types of computer crime. Please provide a detailed description for all crimes, and share an example of where an organization was impacted by each of the types. 2. Elaborat ...

How can word processing software give a person the ability

How can Word Processing software give a person the ability to better position themself or a business, in today's society? Why?

Suppose our task is to distinguish between humans and

Suppose our task is to distinguish between humans and non-human objects in an image, which classifier would you choose and why? Decision trees, perceptrons or neural nets.

A salesforce from an ecommerce global organization has

A salesforce from an ecommerce global organization has begun to raise some concerns about the orders they are transmitting over the Internet from their customers' site to the organization's global headquarters. It seems ...

A weight loss program claims that program participants have

A weight loss program claims that program participants have a mean weight loss of at least 12 pounds after 1 month. You work for a medical association and are asked to test this claim. A random sample of 30 program parti ...

In c languageread a integer number which has 2 digits after

In C language: Read a integer number which has 2 digits after the decimal point. The number also has at least 6 digits the decimal point. Extract all digits at even positions from before the decimal point. Print them in ...

Task allocation and deallocation of mono-dimensional and

Task Allocation and deallocation of mono-dimensional and bi-dimensional arrays represented by pointers a. Declare and implement a function CreateArray(...) that returns a pointer to an array of n integers. b. Declare and ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As