SumOfInput.java 305B

12345678910111213141516171819
  1. /**
  2. * Write a description of class SumOfInput here.
  3. *
  4. * @author (your name)
  5. * @version (a version number or a date)
  6. */
  7. public class SumOfInput
  8. {
  9. public int sumOfInput(int n)
  10. {
  11. int sum = 0;
  12. for (int i=n; i>=1; i--){
  13. sum += i;
  14. }
  15. return sum;
  16. }
  17. }