Main.java 393B

12345678910111213141516171819
  1. import java.util.Scanner;
  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.println("Please inuput a number");
  9. int num1 = in.nextInt();
  10. int sum1 = 0;
  11. for (int i = 0; i <= num1; i++){
  12. sum1 += i;}
  13. System.out.println("the sum is " + sum1);
  14. }
  15. }