12345678910111213141516171819
  1. /**
  2. * Created by iyasuwatts on 10/17/17.
  3. */
  4. import java.util.Scanner;
  5. import java.util.stream.IntStream;
  6. public class Main {
  7. public static void main(String[] args){
  8. Scanner kb = new Scanner(System.in);
  9. System.out.println("Enter an integer");
  10. int num = kb.nextInt();
  11. kb.close();
  12. System.out.println(
  13. IntStream.rangeClosed(1, num).reduce(0, (x, y) -> x + y)
  14. );
  15. }
  16. }