The third week course and test summary report

Third Course summary and test report writing Week (a)

1. printout of all the "number of Narcissus", the so-called "number Narcissus" means a 3-digit number, which is equal to the digits of the cube and the number itself. For example, 153 is a "number daffodils."

2. Write a Java program, find the value of + 13-23 + 33-43 + 973-983 + 993-1003 ... of.

3. Programming seek 1! +2! +3! + ... + 20 !.

4. The write Java programs, calculation 8 + 88 + 888 + 10 ... and the front.

5. If a number is exactly equal to the sum of its factors, this number is called the complete number. All finished programming the number of output within 1000.

6. write applications, output meets + ... + n <maximum positive integer 1 + 2 + 3 8888.

7. FIG below for printing cycle (isosceles triangle)

 1,

package images;

import java.util.Scanner;

public class hua {

    public static void main(String[] args) {
                Scanner input=new Scanner(System.in);
                int i1=input.nextInt();
                input.close();
                int i,a=0,b=0,c=0;
                for(i=100;i<=i;i++) {
                    a=i/100;
                    b=i/10-a*10;
                    c=i-a*100-b*10;
                if(a*a*a+b*b*b+c*c*c==i) {
                        System.out.print(i);
                    }
                }
    }

}

2,

package images;

public class Demo5 {
    public static void main(String[]args) {
        int b=0,k=3;
        int i,n=100;
        int flag=1;
        for(i=1;i<=n;i++) {
            b=b+flag*(i*10+3);
            flag=-flag;
            }
        System.out.print(b);
    }
}

3.

package images;
 import java.util.*;
public class Demo3 {

    public static void main(String[]args) {
        
    Scanner sc = new Scanner(System.in);
     int n = sc.nextInt();
     int sum = 0, num = 1;
     sc.close();
     for(int i = 1;i<=n;i++)
     {
         num = num*i;
         sum = sum+num;
     }
     System.out.println(sum);
    }
}

4.

package images;

public class Demo4 {

    public static void main(String args[]){
        long i,a=0, b=0;
        System.out.println("计算8+88+888...前10项之和");
        for(i=1;i<=10;i++){         //循环10次
            a=a*10+8;           //每一个数是前一个数的10倍加8
            b+=a;               //计算10项之和
        }
        System.out.print(b);
    }
}

7.

package leo;
import java.util.Scanner;
 public class Demo3{

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        char a =sc.next().charAt(0);
        sc.close();
        int n=5;
         for(int u=0;u<n;u++)   {
             for(int k=0;k<n*8-u-1;k++) {
                 System.out.print(" ");
             }
             for(int j=0;j<u*2+1;j++) {
                 if(j==0||j==u*2||u==n-1) {
                     System.out.format("%c",u+65);
                 }
                 else {
                     System.out.print(" ");
                 }
            } 
             System.out.println();
        }
    }
}

总结:学了this的使用方法,用在构造方法中,强调作用,并且不能在普通方法中使用。有些许不懂得还待解除。

Guess you like

Origin www.cnblogs.com/LeoQ/p/11518010.html