试验5
package com.cust.wu.test2;
import java.util.Scanner;
public class getsum {
public static int sumDigits(int n){
System.out.print(n+"=");
int result=0;
while(n%10!=n){
result += n%10;
System.out.print(n%10+"+");
n=n/10;
}
System.out.print(n);
result+=n;
return result;
}
public static void main(String [] args){
Scanner scan=new Scanner(System.in);
int k=scan.nextInt();
sumDigits( k);
}
}
package com.cust.wu.test1;
public class wujiaoshu {
public static int wujiao(int n){
int result=0;
result = n*(3*n-1)/2;
return result;
}
public static void main(String [] args){
for(int j=0;j<=9;j++){
System.out.print("第"+(j+1)+"行");
for(int i=10*j+1;i<=10*(j+1);i++){
System.out.print(wujiao(i)+" ");
}
System.out.println();
}
}
}