Write a function that takes one positive integer value (call it n) as a parameter and produces the sum of the integers between 1 and n.

Hint: The sum of the integers from 1 to n is n*(n+1) all over 2

I know this is how the function should look but I am unsure of how to write the actual code!

(n*(n+1))/2

2 answers

In Visual Basic Form..
Create a full program with proper instructions for the user that asks the person to choose between the following options:

Find out if a year a leap year
Number of days in a month for any given year
Print out the number of days in a year, a leap year, and weeks in a year.
After the user makes their choice calculate the appropriate answers and give fully defined answers. In other words do not simply return True or False for the first choice, give a full response such as "2012 is a leap year."

Properly test the user inputs and respond with error instructions if a wrong or invalid choice is made.
Similar Questions
  1. How would I put this into one program?These are the directions: Write a method that takes two parameters. If the first parameter
    1. answers icon 0 answers
  2. I posted this question before:How would I put this into one program? These are the directions: Write a method that takes two
    1. answers icon 5 answers
    1. answers icon 2 answers
    1. answers icon 1 answer
more similar questions