posted by .

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!


  • Programming -

    In Visual Basic Form..

  • Programming -

    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.

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. discrete math

    1)prove that if x is rational and x not equal to 0, then 1/x is rational. 2) prove that there is a positive integers that equals the sum of the positive integers not exceeding it. Is your proof constructive or nonconstructive?
  2. math, algebra

    2a+2ab+2b I need a lot of help in this one. it says find two consecutive positive integers such that the sum of their square is 85. how would i do this one i have no clue i know what are positive integers.but i don't know how to figure …
  3. math

    there are 8 consecutive integers that add up to 31. Only two of the integers are equal. what is the greatest number for any one integer?
  4. Math

    Let S(n) denote the sum of digits of the integer n. Over all positive integers, the minimum and maximum values of S(n)/S(5n) are X and Y, respectively. The value of X+Y can be written as a/b , where a and b are coprime positive integers. …
  5. math

    Which statement is true? A.The sum of two positive integers is sometimes positive, sometimes negative. B.The sum of two negative integers is always negative. C.The sum of a positive integer and a negative integer is always positive.
  6. math

    Find the sum of the first one thousand positive integers. Explain how you arrived at your result. Now explain how to find the sum of the first n positive integers, where n is any positive integer, without adding a long list of positive …
  7. Math

    Tell whether the sum between the two integers is always, sometimes, or never positive. Two Positive Integers: Sometimes One Positive and one negative integer: Always Is it right?
  8. math

    What is the smallest of three consecutive integers if the sum of the smaller two integers is equal to 177 less than four times the largest?
  9. maths

    the non- decreasing sequence of odd integers {a1, a2, a3, . . .} = {1,3,3,3,5,5,5,5,5,...} each positive odd integer k appears k times. it is a fact that there are integers b, c, and d such that, for all positive integers n, aƱ = …
  10. Algebra 1

    The average of five consecutive integers is 13. One of the integers is removed and the sum of the remaining integers is 53. What is the value of the integer that was removed?

More Similar Questions