1234567891011121314151617181920212223242526
  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. int n = 8;
  8. int tally = 0;
  9. System.out.println("Input a number: ");
  10. Scanner input = new Scanner (System.in);
  11. n = input.nextInt();
  12. for (int i=0; i<=n; i++){
  13. tally += i;
  14. System.out.println(tally);
  15. }
  16. }
  17. }
  18. /*
  19. * * Write a program which prompts the user to input a number, `n`.
  20. * The program should respond by printing the sum of the numbers 1 to `n`.
  21. */