浏览代码

sumOfNums

Jose Bedolla 6 年前
父节点
当前提交
f993752f23
共有 5 个文件被更改,包括 30 次插入7 次删除
  1. 二进制
      Main.class
  2. 5
    0
      Main.ctxt
  3. 19
    1
      Main.java
  4. 0
    0
      README.TXT
  5. 6
    6
      package.bluej

二进制
Main.class 查看文件


+ 5
- 0
Main.ctxt 查看文件

@@ -0,0 +1,5 @@
1
+#BlueJ class context
2
+comment0.target=Main
3
+comment1.params=args
4
+comment1.target=void\ main(java.lang.String[])
5
+numComments=2

+ 19
- 1
Main.java 查看文件

@@ -1,9 +1,27 @@
1 1
 /**
2 2
  * Created by iyasuwatts on 10/17/17.
3 3
  */
4
+import java.util.Scanner;
4 5
 public class Main {
5 6
 
6 7
     public static void main(String[] args){
7
-
8
+        
9
+        Scanner n = new Scanner(System.in);
10
+        
11
+        int one = 1;
12
+        
13
+        //get input
14
+        System.out.println("Enter a number: ");
15
+        int num = n.nextInt();
16
+        
17
+        int count = 0;
18
+        
19
+        for(int i = one; i < num; i++)
20
+        {
21
+            System.out.println("Numbers below yours: " + i);
22
+            count += i;
23
+            
24
+        }
25
+      System.out.println("total " + count);
8 26
     }
9 27
 }

+ 0
- 0
README.TXT 查看文件


+ 6
- 6
package.bluej 查看文件

@@ -1,16 +1,16 @@
1 1
 #BlueJ package file
2
-editor.fx.0.height=0
3
-editor.fx.0.width=0
4
-editor.fx.0.x=0
5
-editor.fx.0.y=0
2
+editor.fx.0.height=722
3
+editor.fx.0.width=800
4
+editor.fx.0.x=487
5
+editor.fx.0.y=23
6 6
 objectbench.height=164
7 7
 objectbench.width=776
8 8
 package.divider.horizontal=0.6
9 9
 package.divider.vertical=0.6845018450184502
10 10
 package.editor.height=364
11 11
 package.editor.width=674
12
-package.editor.x=-816
13
-package.editor.y=445
12
+package.editor.x=347
13
+package.editor.y=23
14 14
 package.frame.height=600
15 15
 package.frame.width=800
16 16
 package.numDependencies=0