Main.java 474B

12345678910111213141516171819202122
  1. /**
  2. * Created by Mexi 05/29/2018.
  3. */
  4. import java.util.Scanner;
  5. import java.lang.Math;
  6. public class Main {
  7. public static void main(String[] args){
  8. Scanner in = new Scanner(System.in);
  9. System.out.println("Please input a number!");
  10. int n = Integer.parseInt(in.nextLine());
  11. int sum = 0;
  12. for (int i=0;i<=n;i++){
  13. sum = sum +i;
  14. }
  15. System.out.println(sum);
  16. }
  17. }