|
@@ -1,9 +1,19 @@
|
1
|
|
-/**
|
2
|
|
- * Created by iyasuwatts on 10/17/17.
|
3
|
|
- */
|
4
|
|
-public class Main {
|
|
1
|
+import java.util.Scanner;
|
5
|
2
|
|
6
|
|
- public static void main(String[] args){
|
|
3
|
+public class Main{
|
7
|
4
|
|
8
|
|
- }
|
|
5
|
+public static void main(String[] args){
|
|
6
|
+
|
|
7
|
+ Scanner stdin = new Scanner(System.in);
|
|
8
|
+
|
|
9
|
+ int num, sum = 0;
|
|
10
|
+
|
|
11
|
+ System.out.println("Please enter a number");
|
|
12
|
+ num = stdin.nextInt();
|
|
13
|
+
|
|
14
|
+ for(int i=1; i<=num; i++){
|
|
15
|
+ sum+=i;
|
|
16
|
+ }
|
|
17
|
+ System.out.println("The sum of the numbers 1 to " + num + " = " + sum);
|
|
18
|
+ }
|
9
|
19
|
}
|