Main.java 464B

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