Class Summing

java.lang.Object
de.hdm_stuttgart.sd1.sum.Summing

public class Summing extends Object
Summing up integer values.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static long
    getSum(int limit)
    Summing up all integers starting from 0 up to and including a given limit Example: Let the limit be 5, then the result is 1 + 2 + 3 + 4 + 5
    static void
    main(String[] args)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • main

      public static void main(String[] args)
      Parameters:
      args - unused
    • getSum

      public static long getSum(int limit)
      Summing up all integers starting from 0 up to and including a given limit Example: Let the limit be 5, then the result is 1 + 2 + 3 + 4 + 5
      Parameters:
      limit - The last number to include into the computed sum
      Returns:
      The sum of 1 + 2 + ... + limit