Main.java 450B

1234567891011121314151617181920212223
  1. /**
  2. * Created by iyasuwatts on 10/17/17.
  3. */
  4. import java.util.*;
  5. public class Main {
  6. public static void main(String[] args){
  7. int x, y, sum = 1;
  8. Scanner sc = new Scanner(System.in);
  9. System.out.println("Input a number below!!");
  10. x = sc.nextInt();
  11. for (y = 1; y <= x; y++){
  12. sum += y;
  13. }
  14. System.out.println("The sum is "+ sum);
  15. }
  16. }