1234567891011121314151617181920212223242526 |
- import java.util.Scanner;
-
- /**
- * Created by iyasuwatts on 10/17/17.
- */
- public class Main {
- public static void main(String[] args){
- int n = 8;
- int tally = 0;
-
-
- System.out.println("Input a number: ");
-
- Scanner input = new Scanner (System.in);
- n = input.nextInt();
-
- for (int i=0; i<=n; i++){
- tally += i;
- System.out.println(tally);
- }
- }
- }
- /*
- * * Write a program which prompts the user to input a number, `n`.
- * The program should respond by printing the sum of the numbers 1 to `n`.
- */
|