{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

15a_Assignment_2 - Assignment#2 A Little Number Crunching...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Assignment #2 - A Little Number Crunching Select one option from the four below. All options are worth the same number of points. The more advanced options are provided for students who find the basic ones too easy and want more of a challenge. Make sure you have read and understand the Modules Information About Programming Assignments and Style Rules for Assignments before submitting this assignment. Hand in only one program, please. OPTION A (Basic): Some Easy Arithmetic Compute and display the following values for the n = 5, 9 and 15: 1 + 2 + 3 + ... + n ( n * (n + 1) ) / 2 1 + 3 + 5 + ... + (2n - 1) n 2 Be sure that your output is well organized and understandable. You might try organizing it in a tabular form (if you can; not required). What I don't want to see are undocumented numbers on the screen. This should all be done in one run of a single program, not several runs with n modified in the source each time. Here are some tips and hints: 1. The "..." is called an "ellipsis" and means "and so forth". So, when n is 9, the expression 1 + 2 + 3 + ... + n really means 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9. For n equal to 9, again, the expression
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}