27a_Assignment_2

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

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

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

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern