Asked by Annabelle

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

Answers

Answered by Annabelle
In Visual Basic Form..
Answered by Anonymous
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.
There are no AI answers yet. The ability to request AI answers is coming soon!

Related Questions