12345678910111213141516171819202122232425
  1. ;import java.util.*;
  2. /**
  3. * Created by iyasuwatts on 10/17/17.
  4. */
  5. public class Main {
  6. public static void main(String[] args){
  7. Scanner in = new Scanner(System.in);
  8. System.out.print("Enter a Number");
  9. int n = in.nextInt(); // user input #
  10. int s = 0; // # to store sum until n is reached
  11. // System.out.println(s); test to make sure n is getting captured
  12. for (int i = 1; i <= n; i++) {
  13. s = i + s;
  14. }
  15. System.out.println(s);
  16. };
  17. };