File tree 3 files changed +46
-2
lines changed
3 files changed +46
-2
lines changed Original file line number Diff line number Diff line change 4
4
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
5
5
"version" : " 0.2.0" ,
6
6
"configurations" : [
7
+ {
8
+ "type" : " java" ,
9
+ "name" : " Launch and" ,
10
+ "request" : " launch" ,
11
+ "mainClass" : " day03.and" ,
12
+ "projectName" : " test_a0501e95"
13
+ },
7
14
{
8
15
"type" : " java" ,
9
16
"name" : " Launch reward" ,
Original file line number Diff line number Diff line change 1
1
package day03 ;
2
- import java .util .Scanner ;
3
2
public class and {
4
3
public static void main (String [] args ) {
5
- System .out .print ("s" );
4
+ int sum = 0 ;
5
+ for (int i = 1 ; i <= 5 ; i ++) {
6
+ sum += i ;
7
+ }
8
+ System .out .println ("1-5和为" + sum );
9
+ sum = 0 ;
10
+ for (int i = 1 ; i <= 100 ; i ++) {
11
+ if (i %2 == 0 ) {
12
+ sum += i ;
13
+ }
14
+ }
15
+ System .out .println ("1-100间偶数和为" + sum );
16
+
17
+ int count = 0 ;
18
+ for (int i = 100 ; i <= 999 ; i ++) {
19
+ int ge = i %10 ;
20
+ int shi = (i %100 )/10 ;
21
+ int bai = i /100 ;
22
+ // System.out.println(ge);
23
+ // System.out.println(shi);
24
+ // System.out.println(bai);
25
+ Double a = Math .pow (ge , 3 );
26
+ Double b = Math .pow (shi , 3 );
27
+ Double c = Math .pow (bai , 3 );
28
+ if (i == a + b + c ) {
29
+ System .out .println (i );
30
+ count += 1 ;
31
+ }
32
+ }
33
+ System .out .println ("水仙花数总共有" + count + "个" );
34
+
35
+ double paper = 0.0001 ;
36
+ double zf = 8848.86 ;
37
+ int count1 = 0 ;
38
+ while (paper <= zf ) {
39
+ paper *= 2 ;
40
+ count1 += 1 ;
41
+ }
42
+ System .out .println ("需要折叠" + count1 + "次" );
6
43
}
7
44
}
You can’t perform that action at this time.
0 commit comments