Main.java 460B

1234567891011121314151617181920
  1. import java.util.*;
  2. /**
  3. * Created by Curtis Cook on 10/17/18.
  4. */
  5. public class Main {
  6. public static void main(String[] args){
  7. Scanner in = new Scanner(System.in);
  8. System.out.println("Please input a number.");
  9. int n = in.nextInt();
  10. int count = 0;
  11. for(int i = 1; i <= n; i++) {
  12. count += i;
  13. }
  14. System.out.println("The sum of numbers between 1 and " + n + " is " + count);
  15. }
  16. }