12345678910111213141516171819202122232425 |
- /**
- * Created by iyasuwatts on 10/17/17.
- */
-
- import java.util.Scanner;
-
- public class SumOfInput {
-
- public static void main(String[] args){
- Scanner scan = new Scanner(System.in);
- System.out.println("Input a number:");
- int number = scan.nextInt();
- int total = 0;
-
- System.out.println("Your number is " + number + "!");
-
- for(int i = 1; i <= number; i++){
- total += i;
- }
-
- System.out.println("The sum is: " + total);
-
- }
- }
|